chore: rename "part" to "step" (#43934)
* chore: rename part to step * chore: update metas * chore: more renaming * chore: update tooling * chore: update frontmatter * chore(tools): title testing
This commit is contained in:
committed by
GitHub
parent
6dbe68eb2f
commit
b36cdbafd1
@@ -2,8 +2,8 @@ const fs = require('fs');
|
||||
const path = require('path');
|
||||
|
||||
// Generates an array with the output of processing filenames with an expected
|
||||
// format (`part-###.md`).
|
||||
// ['part-001.md', 'part-002.md'] => [1, 2]
|
||||
// format (`step-###.md`).
|
||||
// ['step-001.md', 'step-002.md'] => [1, 2]
|
||||
function getExistingStepNums(projectPath) {
|
||||
return fs.readdirSync(projectPath).reduce((stepNums, fileName) => {
|
||||
if (
|
||||
|
@@ -10,8 +10,8 @@ describe('getExistingStepNums helper', () => {
|
||||
it('should return the number portion of the project paths', () => {
|
||||
mock({
|
||||
'mock-project': {
|
||||
'part-001.md': 'Lorem ipsum...',
|
||||
'part-002.md': 'Lorem ipsum...'
|
||||
'step-001.md': 'Lorem ipsum...',
|
||||
'step-002.md': 'Lorem ipsum...'
|
||||
}
|
||||
});
|
||||
|
||||
@@ -26,7 +26,7 @@ describe('getExistingStepNums helper', () => {
|
||||
mock({
|
||||
'mock-project': {
|
||||
'final.md': 'Lorem ipsum...',
|
||||
'part-001.md': 'Lorem ipsum...'
|
||||
'step-001.md': 'Lorem ipsum...'
|
||||
}
|
||||
});
|
||||
|
||||
@@ -40,9 +40,9 @@ describe('getExistingStepNums helper', () => {
|
||||
it('should throw if file names do not follow naming convention', () => {
|
||||
mock({
|
||||
'mock-project': {
|
||||
'part-001.md': 'Lorem ipsum...',
|
||||
'part-002.md': 'Lorem ipsum...',
|
||||
'part002.md': 'Lorem ipsum...'
|
||||
'step-001.md': 'Lorem ipsum...',
|
||||
'step-002.md': 'Lorem ipsum...',
|
||||
'step002.md': 'Lorem ipsum...'
|
||||
}
|
||||
});
|
||||
|
||||
@@ -56,8 +56,8 @@ describe('getExistingStepNums helper', () => {
|
||||
it('should return empty array if there are no markdown files', () => {
|
||||
mock({
|
||||
'mock-project': {
|
||||
'part-001.js': 'Lorem ipsum...',
|
||||
'part-002.css': 'Lorem ipsum...'
|
||||
'step-001.js': 'Lorem ipsum...',
|
||||
'step-002.css': 'Lorem ipsum...'
|
||||
}
|
||||
});
|
||||
|
||||
|
@@ -3,7 +3,7 @@ const path = require('path');
|
||||
const { getChallengeSeeds } = require('../utils');
|
||||
const { getProjectPath } = require('./get-project-path');
|
||||
|
||||
// Looks up the last file found with format `part-###.md` in a directory and
|
||||
// Looks up the last file found with format `step-###.md` in a directory and
|
||||
// returns associated information to it. At the same time validates that the
|
||||
// number of files match the names used to name these.
|
||||
function getLastStepFileContent() {
|
||||
|
@@ -21,8 +21,8 @@ describe('getLastStepFileContent helper', () => {
|
||||
it('should throw if last step count does not match with numbers of steps', () => {
|
||||
mock({
|
||||
'mock-project/': {
|
||||
'part-001.md': 'Lorem ipsum...',
|
||||
'part-004.md': 'Lorem ipsum...',
|
||||
'step-001.md': 'Lorem ipsum...',
|
||||
'step-004.md': 'Lorem ipsum...',
|
||||
'final.md': 'Lorem ipsum...'
|
||||
}
|
||||
});
|
||||
@@ -37,8 +37,8 @@ describe('getLastStepFileContent helper', () => {
|
||||
it('should return information if steps count is correct', () => {
|
||||
mock({
|
||||
'mock-project': {
|
||||
'part-001.md': 'Lorem ipsum...',
|
||||
'part-002.md': 'Lorem ipsum...',
|
||||
'step-001.md': 'Lorem ipsum...',
|
||||
'step-002.md': 'Lorem ipsum...',
|
||||
'final.md': 'Lorem ipsum...'
|
||||
}
|
||||
});
|
||||
|
@@ -58,9 +58,9 @@ function getStepTemplate({
|
||||
return (
|
||||
`---
|
||||
id: ${challengeId}
|
||||
title: Part ${stepNum}
|
||||
title: Step ${stepNum}
|
||||
challengeType: 0
|
||||
dashedName: part-${stepNum}
|
||||
dashedName: step-${stepNum}
|
||||
---
|
||||
|
||||
# --description--
|
||||
|
@@ -6,9 +6,9 @@ describe('getStepTemplate util', () => {
|
||||
it('should be able to create a markdown', () => {
|
||||
const baseOutput = `---
|
||||
id: 60d4ebe4801158d1abe1b18f
|
||||
title: Part 5
|
||||
title: Step 5
|
||||
challengeType: 0
|
||||
dashedName: part-5
|
||||
dashedName: step-5
|
||||
---
|
||||
|
||||
# --description--
|
||||
|
Reference in New Issue
Block a user