fix: Add rimraf to devDependencies for single and multi projects and use it in npm scripts
MODIFY
package.json
package.json
"bugs": "https://github.com/oclif/oclif/issues",
"dependencies": {
"@oclif/command": "^1.4.33",
- "@oclif/config": "^1.6.27",
+ "@oclif/config": "^1.6.28",
"@oclif/errors": "^1.1.2",
"@oclif/plugin-help": "^2.0.5",
"@oclif/plugin-not-found": "^1.0.9",
"yosay": "^2.0.2"
},
"devDependencies": {
- "@oclif/dev-cli": "^1.13.30",
+ "@oclif/dev-cli": "^1.13.31",
"@oclif/tslint": "^1.1.2",
"@types/lodash": "^4.14.109",
"@types/read-pkg": "^3.0.0",
"nps": "^5.9.0",
"shelljs": "^0.8.2",
"tmp": "^0.0.33",
- "ts-node": "^6.1.0",
+ "ts-node": "^6.1.1",
"tslint": "^5.10.0",
"typescript": "^2.9.1"
},

MODIFY
src/generators/app.ts
src/generators/app.ts
@@ -14,6 +14,10 @@ const fixpack = require('fixpack')
const debug = require('debug')('generator-oclif')
const {version} = require('../../package.json')
+const isWindows = process.platform === 'win32'
+const rmrf = isWindows ? 'rimraf' : 'rm -rf'
+const rmf = isWindows ? 'rimraf' : 'rm -f'
+
let hasYarn = false
try {
execSync('yarn -v')
@@ -262,12 +266,11 @@ class App extends Generator {
this.pjson.scripts.test = 'echo NO TESTS'
}
if (this.ts) {
- this.pjson.scripts.prepare = 'rm -rf lib && tsc'
- this.pjson.scripts.prepack = 'rm -rf lib && tsc'
+ this.pjson.scripts.prepack = this.pjson.scripts.prepare = `${rmrf} lib && tsc`
}
if (['plugin', 'multi'].includes(this.type)) {
this.pjson.scripts.prepack = nps.series(this.pjson.scripts.prepack, 'oclif-dev manifest', 'oclif-dev readme')
- this.pjson.scripts.postpack = nps.series(this.pjson.scripts.postpack, 'rm -f oclif.manifest.json')
+ this.pjson.scripts.postpack = nps.series(this.pjson.scripts.postpack, `${rmf} oclif.manifest.json`)
this.pjson.scripts.version = nps.series('oclif-dev readme', 'git add README.md')
this.pjson.files.push('/oclif.manifest.json')
}
@@ -449,6 +452,7 @@ class App extends Generator {
'eslint-config-oclif@^1',
)
}
+ if (isWindows) devDependencies.push('rimraf')
let yarnOpts = {} as any
if (process.env.YARN_MUTEX) yarnOpts.mutex = process.env.YARN_MUTEX
const install = (deps: string[], opts: object) => this.yarn ? this.yarnInstall(deps, opts) : this.npmInstall(deps, opts)

MODIFY
yarn.lock
yarn.lock
debug "^3.1.0"
semver "^5.5.0"
-"@oclif/command@^1.4.32":
- version "1.4.32"
- resolved "https://registry.yarnpkg.com/@oclif/command/-/command-1.4.32.tgz#1cb2eb9637340a1ac69da35e407316688f736647"
- dependencies:
- "@oclif/errors" "^1.1.2"
- "@oclif/parser" "^3.4.1"
- debug "^3.1.0"
- semver "^5.5.0"
-
"@oclif/command@^1.4.33":
version "1.4.33"
resolved "https://registry.yarnpkg.com/@oclif/command/-/command-1.4.33.tgz#40a48e7384d6b4394c2ca20e5c05ff45541087f5"
debug "^3.1.0"
tslib "^1.9.2"
-"@oclif/dev-cli@^1.13.30":
- version "1.13.30"
- resolved "https://registry.yarnpkg.com/@oclif/dev-cli/-/dev-cli-1.13.30.tgz#bcda36f634b82d4591447f229cc5f735b477a598"
+"@oclif/config@^1.6.28":
+ version "1.6.28"
+ resolved "https://registry.yarnpkg.com/@oclif/config/-/config-1.6.28.tgz#bfda0718ba5dfbdeb364350990ed79540f9c3d0b"
+ dependencies:
+ debug "^3.1.0"
+ tslib "^1.9.2"
+
+"@oclif/dev-cli@^1.13.31":
+ version "1.13.31"
+ resolved "https://registry.yarnpkg.com/@oclif/dev-cli/-/dev-cli-1.13.31.tgz#ddcca19e1346de3656b63210305c87acdc98fd44"
dependencies:
- "@oclif/command" "^1.4.32"
+ "@oclif/command" "^1.4.33"
"@oclif/config" "^1.6.27"
"@oclif/errors" "^1.1.2"
- "@oclif/plugin-help" "^2.0.4"
- cli-ux "^4.6.0"
+ "@oclif/plugin-help" "^2.0.5"
+ cli-ux "^4.6.2"
debug "^3.1.0"
fs-extra "^6.0.1"
lodash "^4.17.10"
"@oclif/linewrap" "^1.0.0"
chalk "^2.4.1"
-"@oclif/parser@^3.4.1":
- version "3.4.1"
- resolved "https://registry.yarnpkg.com/@oclif/parser/-/parser-3.4.1.tgz#83942276f3cf9406a1a3dcf3eb917183d6333e1d"
- dependencies:
- "@oclif/linewrap" "^1.0.0"
- chalk "^2.4.1"
-
"@oclif/parser@^3.5.1":
version "3.5.1"
resolved "https://registry.yarnpkg.com/@oclif/parser/-/parser-3.5.1.tgz#2f60ac9773565786b6e1afff967b36a6399defcc"
"@oclif/linewrap" "^1.0.0"
chalk "^2.4.1"
-"@oclif/plugin-help@^2.0.4":
- version "2.0.4"
- resolved "https://registry.yarnpkg.com/@oclif/plugin-help/-/plugin-help-2.0.4.tgz#32cf1dc7696f626a6065109a17b0f061adb14243"
- dependencies:
- "@oclif/command" "^1.4.30"
- chalk "^2.4.1"
- indent-string "^3.2.0"
- lodash.template "^4.4.0"
- string-width "^2.1.1"
- widest-line "^2.0.0"
- wrap-ansi "^3.0.1"
-
"@oclif/plugin-help@^2.0.5":
version "2.0.5"
resolved "https://registry.yarnpkg.com/@oclif/plugin-help/-/plugin-help-2.0.5.tgz#98084286099b44c8c6ed6214e3589f32525f4827"
@@ -740,9 +719,9 @@ cli-table@^0.3.1:
dependencies:
colors "1.0.3"
-cli-ux@^4.6.0:
- version "4.6.1"
- resolved "https://registry.yarnpkg.com/cli-ux/-/cli-ux-4.6.1.tgz#2cc7feb4d48932a95bffe712426eaa36ec861004"
+cli-ux@^4.6.2:
+ version "4.6.2"
+ resolved "https://registry.yarnpkg.com/cli-ux/-/cli-ux-4.6.2.tgz#77a4eeb93ffb40c697e4f1d60975804134ba7a5a"
dependencies:
"@oclif/linewrap" "^1.0.0"
"@oclif/screen" "^1.0.2"
@@ -3415,9 +3394,9 @@ trim-newlines@^1.0.0:
version "1.0.0"
resolved "https://registry.yarnpkg.com/trim-newlines/-/trim-newlines-1.0.0.tgz#5887966bb582a4503a41eb524f7d35011815a613"
-ts-node@^6.1.0:
- version "6.1.0"
- resolved "https://registry.yarnpkg.com/ts-node/-/ts-node-6.1.0.tgz#a2c37a11fdb58e60eca887a1269b025cf4d2f8b8"
+ts-node@^6.1.1:
+ version "6.1.1"
+ resolved "https://registry.yarnpkg.com/ts-node/-/ts-node-6.1.1.tgz#19607140acb06150441fcdb61be11f73f7b6657e"
dependencies:
arrify "^1.0.0"
diff "^3.1.0"

fix: Add rimraf to devDependencies for single and multi projects and use it in npm scripts (#123)