Skip to content
This repository was archived by the owner on Mar 4, 2025. It is now read-only.

Commit 64991bb

Browse files
authored
feat: migrate to monorepo (#458)
1 parent 72706d2 commit 64991bb

File tree

106 files changed

+2612
-281
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

106 files changed

+2612
-281
lines changed

.eslintignore

+4-3
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
_*.js
2-
template/nuxt/pages/index.vue
3-
template/frameworks/iview/pages/index.vue
4-
template/frameworks/jest/jest.config.js
2+
node_modules
3+
packages/cna-template/template/nuxt/pages/index.vue
4+
packages/cna-template/template/frameworks/iview/pages/index.vue
5+
packages/cna-template/template/frameworks/jest/jest.config.js

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ node_modules
33

44
# Logs
55
npm-debug.log
6+
yarn-error.log
67

78
# Coverage
89
coverage

ava.config.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
export default {
22
ignoredByWatcher: ['!**/*.{js}'],
3-
files: ['./test/*.test.js', '!template'],
3+
files: ['./packages/*/test/*.test.js', '!template'],
44
tap: false,
55
verbose: true,
66
babel: true

lerna.json

+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
{
2+
"version": "2.15.0",
3+
"npmClient": "yarn",
4+
"useWorkspaces": true,
5+
"packages": [
6+
"packages/*"
7+
],
8+
"command": {
9+
"publish": {
10+
"npmClient": "npm"
11+
},
12+
"version": {
13+
"conventionalCommits": true
14+
}
15+
},
16+
"changelog": {
17+
"labels": {
18+
"feat": "New Feature",
19+
"fix": "Bug Fix",
20+
"docs": "Documentation",
21+
"perf": "Performance",
22+
"refactor": "Code Refactoring"
23+
}
24+
}
25+
}

package.json

+7-30
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,7 @@
11
{
2-
"name": "create-nuxt-app",
3-
"version": "2.15.0",
4-
"description": "Create a Nuxt.js App in seconds.",
5-
"bin": "cli.js",
6-
"files": [
7-
"cli.js",
8-
"prompts.js",
9-
"saofile.js",
10-
"template/"
2+
"private": true,
3+
"workspaces": [
4+
"packages/*"
115
],
126
"repository": {
137
"url": "git+https://github.com/nuxt/create-nuxt-app.git",
@@ -16,31 +10,14 @@
1610
"scripts": {
1711
"lint": "eslint --ext .js,.mjs,.vue .",
1812
"test": "ava --verbose",
19-
"test:snapshot": "ava --verbose --update-snapshots",
20-
"release": "standard-version"
21-
},
22-
"dependencies": {
23-
"cac": "^6.5.8",
24-
"chalk": "^2.4.2",
25-
"cross-spawn": "^7.0.2",
26-
"envinfo": "^7.5.0",
27-
"glob": "^7.1.6",
28-
"lodash": "^4.17.15",
29-
"sao": "^1.7.0",
30-
"superb": "^4.0.0",
31-
"validate-npm-package-name": "^3.0.0"
13+
"test:snapshot": "ava --verbose --update-snapshots"
3214
},
3315
"devDependencies": {
34-
"@nuxtjs/eslint-config": "^2.0.2",
3516
"@ava/babel": "^1.0.1",
17+
"@nuxtjs/eslint-config": "^2.0.2",
3618
"ava": "^3.5.2",
3719
"eslint": "^6.8.0",
38-
"standard-version": "^7.1.0"
20+
"lerna": "^3.20.2"
3921
},
40-
"authors": [
41-
"Egoist <[email protected]>",
42-
"Nuxt team <[email protected]>",
43-
"Clark Du <[email protected]>"
44-
],
45-
"license": "MIT"
22+
"name": "create-nuxt-app"
4623
}

packages/cna-template/package.json

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"name": "cna-template",
3+
"version": "2.15.0",
4+
"description": "Templates for Create Nuxt App.",
5+
"files": [
6+
"template"
7+
],
8+
"license": "MIT"
9+
}
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

cli.js packages/create-nuxt-app/lib/cli.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ const sao = require('sao')
44
const cac = require('cac')
55
const chalk = require('chalk')
66
const envinfo = require('envinfo')
7-
const { version } = require('./package.json')
7+
const { version } = require('../package.json')
88

99
const generator = path.resolve(__dirname, './')
1010

File renamed without changes.

saofile.js packages/create-nuxt-app/lib/saofile.js

+11-8
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
1-
const { join, relative } = require('path')
1+
const { dirname, join, relative } = require('path')
22
const glob = require('glob')
33
const spawn = require('cross-spawn')
44
const validate = require('validate-npm-package-name')
55

6-
const rootDir = __dirname
6+
const cnaTemplateDir = join(dirname(require.resolve('cna-template/package.json')))
7+
const templateDir = join(cnaTemplateDir, 'template')
8+
const frameworksDir = join(templateDir, 'frameworks')
79

810
module.exports = {
911
prompts: require('./prompts'),
@@ -53,7 +55,7 @@ module.exports = {
5355
const actions = [{
5456
type: 'add',
5557
files: '**',
56-
templateDir: 'template/nuxt',
58+
templateDir: join(templateDir, 'nuxt'),
5759
filters: {
5860
'static/icon.png': 'features.includes("pwa")'
5961
}
@@ -63,23 +65,23 @@ module.exports = {
6365
actions.push({
6466
type: 'add',
6567
files: '**',
66-
templateDir: `template/frameworks/${this.answers.ui}`
68+
templateDir: join(frameworksDir, this.answers.ui)
6769
})
6870
}
6971

7072
if (this.answers.test !== 'none') {
7173
actions.push({
7274
type: 'add',
7375
files: '**',
74-
templateDir: `template/frameworks/${this.answers.test}`
76+
templateDir: join(frameworksDir, this.answers.test)
7577
})
7678
}
7779

7880
if (this.answers.server !== 'none') {
7981
if (this.answers.server === 'adonis') {
8082
const files = {}
8183
for (const action of actions) {
82-
const options = { cwd: join(rootDir, action.templateDir), dot: true }
84+
const options = { cwd: action.templateDir, dot: true }
8385
for (const file of glob.sync('*', options)) {
8486
files[file] = `resources/${file}`
8587
}
@@ -95,7 +97,7 @@ module.exports = {
9597
actions.push({
9698
type: 'add',
9799
files: '**',
98-
templateDir: `template/frameworks/${this.answers.server}`
100+
templateDir: join(frameworksDir, this.answers.server)
99101
})
100102
}
101103

@@ -110,7 +112,8 @@ module.exports = {
110112
'semantic.yml': 'devTools.includes("semantic-pull-requests")',
111113
'.env': 'features.includes("dotenv")',
112114
'_stylelint.config.js': 'linter.includes("stylelint")'
113-
}
115+
},
116+
templateDir
114117
})
115118

116119
actions.push({

packages/create-nuxt-app/package.json

+27
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
{
2+
"name": "create-nuxt-app",
3+
"version": "2.15.0",
4+
"description": "Create a Nuxt.js App in seconds.",
5+
"bin": "lib/cli.js",
6+
"files": [
7+
"lib"
8+
],
9+
"dependencies": {
10+
"cac": "^6.5.8",
11+
"chalk": "^2.4.2",
12+
"cna-template": "^2.15.0",
13+
"cross-spawn": "^7.0.2",
14+
"envinfo": "^7.5.0",
15+
"glob": "^7.1.6",
16+
"lodash": "^4.17.15",
17+
"sao": "^1.7.0",
18+
"superb": "^4.0.0",
19+
"validate-npm-package-name": "^3.0.0"
20+
},
21+
"authors": [
22+
"Egoist <[email protected]>",
23+
"Nuxt team <[email protected]>",
24+
"Clark Du <[email protected]>"
25+
],
26+
"license": "MIT"
27+
}

test/index.test.js packages/create-nuxt-app/test/index.test.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
import path from 'path'
22
import test from 'ava'
33
import sao from 'sao'
4-
import saoConfig from '../saofile'
4+
import saoConfig from '../lib/saofile'
55

6-
const generator = path.join(__dirname, '..')
6+
const generator = path.join(__dirname, '../lib')
77

88
const getPkgFields = (pkg) => {
99
pkg = JSON.parse(pkg)

test/snapshots/index.test.js.md packages/create-nuxt-app/test/snapshots/index.test.js.md

+1-1
Binary file not shown.

0 commit comments

Comments
 (0)