generator-chisel 1.0.0-alpha.6 → 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (30) hide show
  1. package/CHANGELOG.md +82 -0
  2. package/README.md +20 -0
  3. package/bin/chisel.js +39 -20
  4. package/lib/commands/create/CreatorPluginAPI.js +5 -1
  5. package/lib/commands/create/creators/app/index.js +22 -3
  6. package/lib/commands/create/creators/app/template/.eslintignore +1 -0
  7. package/lib/commands/create/creators/app/template/.eslintrc.js +1 -1
  8. package/lib/commands/create/creators/app/template/.gitignore.chisel-tpl +53 -0
  9. package/lib/commands/create/creators/app/template/.prettierignore +1 -0
  10. package/lib/commands/create/creators/app/template/.stylelintignore +1 -0
  11. package/lib/commands/create/creators/app/template/babel.config.js +1 -1
  12. package/lib/commands/create/creators/app/template/chisel.config.chisel-tpl.js +17 -5
  13. package/lib/commands/create/creators/app/template/package.chisel-tpl.json +6 -6
  14. package/lib/commands/create/creators/app/template/postcss.config.js +1 -1
  15. package/lib/commands/create/creators/app/template/src/styles/elements/_blockquote.scss +2 -2
  16. package/lib/commands/create/creators/app/template/src/styles/generic/_box-sizing.scss +2 -2
  17. package/lib/commands/create/creators/app/template/src/styles/tools/_clearfix.scss +1 -1
  18. package/lib/commands/create/creators/fe/index-styles.css +147 -0
  19. package/lib/commands/create/creators/fe/index.js +51 -0
  20. package/lib/commands/create/creators/fe/template/.htmlhintrc +3 -0
  21. package/lib/commands/create/creators/fe/template/public/.keep +0 -0
  22. package/lib/commands/create/creators/fe/template-index/index.chisel-tpl.html +77 -0
  23. package/lib/commands/create/creators/fe/template-index/index.chisel-tpl.html.rej +13 -0
  24. package/lib/commands/create/creators/init.js +3 -0
  25. package/lib/commands/create/creators/wp/chisel-starter-theme/.gitignore.chisel-tpl +1 -0
  26. package/lib/commands/create/creators/wp/index.js +4 -0
  27. package/lib/commands/create/creators/wp/template/wp/.gitignore.chisel-tpl +2 -0
  28. package/lib/commands/create/packages-versions.js +9 -8
  29. package/lib/commands/create/priorities.js +1 -0
  30. package/package.json +4 -4
package/CHANGELOG.md ADDED
@@ -0,0 +1,82 @@
1
+ # Changelog
2
+
3
+ <!-- INSERT-NEW-ENTRIES-HERE -->
4
+
5
+ ## 1.0.0 (2021-12-17)
6
+
7
+ - Rewrite with Webpack (#509) ([14fa2d0](https://github.com/xfiveco/generator-chisel/commit/14fa2d0)), closes [#509](https://github.com/xfiveco/generator-chisel/issues/509)
8
+
9
+ ## 1.0.0-alpha.14 (2021-12-16)
10
+
11
+ - Fix ::before and ::after ([adf82b3](https://github.com/xfiveco/generator-chisel/commit/adf82b3)), closes [#508](https://github.com/xfiveco/generator-chisel/issues/508)
12
+
13
+ ## 1.0.0-alpha.13 (2021-09-29)
14
+
15
+ - Change postcss-normalize package ([f1b9ea4](https://github.com/xfiveco/generator-chisel/commit/f1b9ea4))
16
+ - Fix Eslint import error (#493) (#496) ([0e0fabe](https://github.com/xfiveco/generator-chisel/commit/0e0fabe)), closes [#493](https://github.com/xfiveco/generator-chisel/issues/493) [#496](https://github.com/xfiveco/generator-chisel/issues/496)
17
+ - Minify Styles & Update Tests (#501) ([4a2e720](https://github.com/xfiveco/generator-chisel/commit/4a2e720)), closes [#501](https://github.com/xfiveco/generator-chisel/issues/501)
18
+ - Update chisel index page (#497) (#499) ([7219131](https://github.com/xfiveco/generator-chisel/commit/7219131)), closes [#497](https://github.com/xfiveco/generator-chisel/issues/497) [#499](https://github.com/xfiveco/generator-chisel/issues/499) [#499](https://github.com/xfiveco/generator-chisel/issues/499)
19
+
20
+ ## 1.0.0-alpha.12 (2021-01-23)
21
+
22
+ - Support Node 14 ([c7da9a6](https://github.com/xfiveco/generator-chisel/commit/c7da9a6))
23
+
24
+ ## 1.0.0-alpha.11 (2020-09-21)
25
+
26
+ - Change gitignore file name to ensure they're include in npm package ([f09752e](https://github.com/xfiveco/generator-chisel/commit/f09752e))
27
+ - Publish ([f804f33](https://github.com/xfiveco/generator-chisel/commit/f804f33))
28
+
29
+ ## 1.0.0-alpha.10 (2020-08-04)
30
+
31
+ - Add frontend generator and commands tests ([c32fa26](https://github.com/xfiveco/generator-chisel/commit/c32fa26))
32
+ - Change minimum node version per earlier tests with travis ([b809708](https://github.com/xfiveco/generator-chisel/commit/b809708))
33
+ - Improve config template ([a4cff31](https://github.com/xfiveco/generator-chisel/commit/a4cff31))
34
+ - Improve default ignore files ([44ce712](https://github.com/xfiveco/generator-chisel/commit/44ce712))
35
+ - Publish ([6a85f99](https://github.com/xfiveco/generator-chisel/commit/6a85f99))
36
+ - Publish ([f770d3c](https://github.com/xfiveco/generator-chisel/commit/f770d3c))
37
+
38
+ ## 1.0.0-alpha.9 (2020-07-21)
39
+
40
+ - Ignore dist in generated projects ([f9c76a0](https://github.com/xfiveco/generator-chisel/commit/f9c76a0))
41
+
42
+ ## 1.0.0-alpha.8 (2020-07-21)
43
+
44
+ - Add Changelogs ([25d6245](https://github.com/xfiveco/generator-chisel/commit/25d6245))
45
+ - Add Readmes ([35fd430](https://github.com/xfiveco/generator-chisel/commit/35fd430))
46
+ - Add some tests and travis config ([7b89252](https://github.com/xfiveco/generator-chisel/commit/7b89252))
47
+ - Add Static Frontend ([0c6db7a](https://github.com/xfiveco/generator-chisel/commit/0c6db7a))
48
+ - Update incorrect log & comment ([f7037a3](https://github.com/xfiveco/generator-chisel/commit/f7037a3))
49
+
50
+ ## 1.0.0-alpha.7 (2020-07-06)
51
+
52
+ - Add hooks to modify webpack options and few other things ([9ec1f07](https://github.com/xfiveco/generator-chisel/commit/9ec1f07))
53
+
54
+ ## 1.0.0-alpha.6 (2020-07-06)
55
+
56
+ - Add build report support ([048a84a](https://github.com/xfiveco/generator-chisel/commit/048a84a))
57
+
58
+ ## 1.0.0-alpha.5 (2020-07-06)
59
+
60
+ - Add add-page command ([1a98eb4](https://github.com/xfiveco/generator-chisel/commit/1a98eb4))
61
+ - Fix templates in php files ([87f1258](https://github.com/xfiveco/generator-chisel/commit/87f1258))
62
+ - Format Settings and initManifest in ChiselTwig.php ([55f6b20](https://github.com/xfiveco/generator-chisel/commit/55f6b20))
63
+
64
+ ## 1.0.0-alpha.4 (2020-07-06)
65
+
66
+ - Include license when sorting package.json ([fd206c2](https://github.com/xfiveco/generator-chisel/commit/fd206c2))
67
+
68
+ ## 1.0.0-alpha.3 (2020-07-03)
69
+
70
+ - Fix lint/buid with npm ([d81791b](https://github.com/xfiveco/generator-chisel/commit/d81791b))
71
+
72
+ ## 1.0.0-alpha.2 (2020-07-03)
73
+
74
+ - Fix command with npm, remove unused variable ([e1c1d07](https://github.com/xfiveco/generator-chisel/commit/e1c1d07))
75
+
76
+ ## 1.0.0-alpha.1 (2020-07-03)
77
+
78
+ - Fix typo, make browsersync port configurable ([a76890e](https://github.com/xfiveco/generator-chisel/commit/a76890e))
79
+
80
+ ## 1.0.0-alpha.0 (2020-07-01)
81
+
82
+ - Rewrite with webpack ([75952b3](https://github.com/xfiveco/generator-chisel/commit/75952b3))
package/README.md ADDED
@@ -0,0 +1,20 @@
1
+ [![Build Status](https://travis-ci.org/xfiveco/generator-chisel.svg?branch=master)](https://travis-ci.org/xfiveco/generator-chisel) [![NPM version](https://badge.fury.io/js/generator-chisel.svg)](https://badge.fury.io/js/generator-chisel) [![NPM dependiencies](https://david-dm.org/xfiveco/generator-chisel.svg)](https://david-dm.org/xfiveco/generator-chisel)
2
+
3
+ # Chisel
4
+
5
+ Chisel is a development framework for creating easy to maintain and fast WordPress websites and front-end templates.
6
+
7
+ **New version: We are currently working on a complete rewrite of Chisel with Webpack. Check out [how to install and test the new version](https://github.com/xfiveco/generator-chisel/issues/465).**
8
+
9
+ ## Learn more
10
+ - [Introduction](https://www.getchisel.co/)
11
+ - [Documentation](https://www.getchisel.co/docs/)
12
+ - [Installation](https://www.getchisel.co/docs/installation/)
13
+ - [Project Setup](https://www.getchisel.co/docs/setup/)
14
+ - [Project Structure](https://www.getchisel.co/docs/structure/)
15
+ - [Development](https://www.getchisel.co/docs/development/)
16
+ - [In Simple Terms](https://www.getchisel.co/docs/simple/)
17
+ - [Tutorials](https://www.getchisel.co/tutorials/)
18
+
19
+ ## License
20
+ Chisel is licensed under [MIT License](LICENSE).
package/bin/chisel.js CHANGED
@@ -1,32 +1,51 @@
1
1
  #!/usr/bin/env node
2
2
 
3
- const program = require('commander');
3
+ const { Command } = require('commander');
4
4
 
5
5
  const handlePromise = (promise) =>
6
6
  promise.catch((err) => {
7
- console.error(err);
8
- process.exit(1);
9
- });
7
+ if (typeof jest === 'undefined') {
8
+ console.error(err);
9
+ process.exit(1);
10
+ }
10
11
 
11
- program
12
- .command('create')
13
- .description('create a new project powered by Chisel')
14
- .option('--skip-wp-download')
15
- .option('--skip-wp-config')
16
- .option('--skip-wp-install')
17
- .option('--skip-wp-plugins')
18
- .option(
19
- '--link',
20
- 'link Chisel packages (yarn link) in created project (for development)',
21
- )
22
- .action((...args) => {
23
- const cmd = args.slice(-1)[0];
24
- args = args.slice(0, -1);
25
- handlePromise(require('../lib/commands/create')({ args, cmd }));
12
+ return Promise.reject(err);
26
13
  });
27
14
 
15
+ const createProgram = () => {
16
+ const program = new Command();
17
+
18
+ program
19
+ .command('create')
20
+ .description('create a new project powered by Chisel')
21
+ .option('--skip-dependencies-install')
22
+ .option('--skip-wp-download')
23
+ .option('--skip-wp-config')
24
+ .option('--skip-wp-install')
25
+ .option('--skip-wp-commands')
26
+ .option('--skip-wp-plugins')
27
+ .option('--skip-fe-add-index')
28
+ .option('--skip-format-and-build')
29
+ .option(
30
+ '--link',
31
+ 'link Chisel packages (yarn link) in created project (for development)',
32
+ )
33
+ .action((...args) => {
34
+ const cmd = args.slice(-1)[0];
35
+ args = args.slice(0, -1);
36
+ return handlePromise(require('../lib/commands/create')({ args, cmd }));
37
+ });
38
+
39
+ return program;
40
+ };
41
+
28
42
  (async () => {
29
- // TODO: check updates
43
+ if (typeof jest !== 'undefined') {
44
+ module.exports = (argv) => createProgram().parseAsync(argv);
45
+ return;
46
+ }
47
+
48
+ const program = createProgram();
30
49
 
31
50
  program.parse(process.argv);
32
51
 
@@ -39,6 +39,8 @@ module.exports = class CreatorPluginAPI {
39
39
  this.creator.data,
40
40
  );
41
41
 
42
+ // console.log(answers, { answers: JSON.stringify(answers) });
43
+
42
44
  merge(this.creator.data, answers);
43
45
 
44
46
  return this.creator.data[this.id];
@@ -46,7 +48,9 @@ module.exports = class CreatorPluginAPI {
46
48
 
47
49
  // eslint-disable-next-line class-methods-use-this
48
50
  async promptLocal(questions) {
49
- return inquirer.prompt(questions);
51
+ const answers = await inquirer.prompt(questions);
52
+ // console.log({ answers: JSON.stringify(answers) });
53
+ return answers;
50
54
  }
51
55
 
52
56
  // @param from is relative to creator directory
@@ -42,9 +42,8 @@ module.exports = async (api) => {
42
42
  value: 'wp-with-fe',
43
43
  },
44
44
  {
45
- name: 'Front-end Templates (not supported)',
45
+ name: 'Static Website',
46
46
  value: 'fe',
47
- disabled: true,
48
47
  },
49
48
  ],
50
49
  },
@@ -83,6 +82,8 @@ module.exports = async (api) => {
83
82
 
84
83
  if (projectType === 'wp-with-fe') {
85
84
  await api.creator.loadCreator('wp');
85
+ } else if (projectType === 'fe') {
86
+ await api.creator.loadCreator('fe');
86
87
  }
87
88
  });
88
89
 
@@ -96,6 +97,10 @@ module.exports = async (api) => {
96
97
  const modifyDependencies = (deps) => {
97
98
  Object.keys(deps).forEach((dep) => {
98
99
  if (!packagesVersions[dep]) return;
100
+ if (process.env.CHISEL_TEST) {
101
+ deps[dep] = `file:../../packages/${dep}`;
102
+ return;
103
+ }
99
104
  deps[dep] = `^${packagesVersions[dep]}`;
100
105
  });
101
106
  };
@@ -112,6 +117,16 @@ module.exports = async (api) => {
112
117
  });
113
118
 
114
119
  api.schedule(api.PRIORITIES.INSTALL_DEPENDENCIES, async () => {
120
+ if (api.creator.cmd.skipDependenciesInstall) return;
121
+
122
+ if (process.env.CHISEL_TEST && !process.env.CI) {
123
+ require('fs').symlinkSync(
124
+ process.env.CHISEL_TEST_NODE_MODULES,
125
+ api.resolve('node_modules'),
126
+ 'junction',
127
+ );
128
+ }
129
+
115
130
  await installDependencies({ cwd: api.resolve() });
116
131
 
117
132
  if (api.creator.cmd.link) {
@@ -134,12 +149,16 @@ module.exports = async (api) => {
134
149
  });
135
150
 
136
151
  api.schedule(api.PRIORITIES.FORMAT, async () => {
152
+ if (api.creator.cmd.skipFormatAndBuild) return;
153
+
137
154
  console.log('Formatting code...');
138
155
  await runLocalCurrent(['chisel-scripts', 'lint'], { silent: true });
139
156
  });
140
157
 
141
158
  api.schedule(api.PRIORITIES.BUILD, async () => {
142
- console.log('Linting and building...');
159
+ if (api.creator.cmd.skipFormatAndBuild) return;
160
+
161
+ console.log('Building...');
143
162
  await runLocalCurrent(['chisel-scripts', 'build'], {
144
163
  execaOpts: { stdio: 'inherit' },
145
164
  });
@@ -1,3 +1,4 @@
1
1
  !.eslintrc.js
2
+ /src/assets
2
3
  /dist
3
4
  /wp
@@ -1,5 +1,5 @@
1
1
  process.env.CHISEL_CONTEXT = __dirname;
2
- const chiselConfig = require('./chisel.config.js');
2
+ const chiselConfig = require('./chisel.config');
3
3
 
4
4
  let extend = 'chisel';
5
5
 
@@ -0,0 +1,53 @@
1
+ # Numerous always-ignore extensions
2
+ *.diff
3
+ *.err
4
+ *.orig
5
+ *.log
6
+ *.rej
7
+ *.swo
8
+ *.swp
9
+ *.vi
10
+ *.7z
11
+ *.dmg
12
+ *.gz
13
+ *.iso
14
+ *.rar
15
+ *.tar
16
+ *~
17
+
18
+ # OS or Editor folders
19
+ .DS_Store
20
+ ._*
21
+ Desktop.ini
22
+ Thumbs.db
23
+ .Spotlight-V100
24
+ .Trashes
25
+ .cache
26
+ .project
27
+ .settings
28
+ .tmproj
29
+ *.esproj
30
+ nbproject
31
+ *.sublime-project
32
+ *.sublime-workspace
33
+ .idea
34
+
35
+ # Folders to ignore
36
+ temp
37
+ tmp
38
+ .tmp
39
+ node_modules
40
+
41
+ # Others
42
+ npm-debug.log
43
+ .rbenv
44
+ .rbenv-version
45
+ .ruby-gemset
46
+ .ruby-version
47
+ .rvmrc
48
+ .vagrant
49
+
50
+ # Chisel
51
+ /dev-vhost.conf
52
+ /chisel.config.local.js
53
+ /dist
@@ -1,3 +1,4 @@
1
1
  node_modules
2
+ /src/assets
2
3
  /dist
3
4
  /wp
@@ -1,2 +1,3 @@
1
+ /src/assets
1
2
  /dist
2
3
  /wp
@@ -1,4 +1,4 @@
1
- const chiselConfig = require('./chisel.config.js');
1
+ const chiselConfig = require('./chisel.config');
2
2
 
3
3
  module.exports = {
4
4
  presets: [
@@ -1,10 +1,13 @@
1
+ /* eslint-disable no-param-reassign */
2
+
1
3
  const creatorData = <%= JSON.stringify(creatorData) %>;
2
4
 
3
5
  <%
4
6
  const isWP = app.projectType == 'wp-with-fe';
5
- let url = /^https?:\/\//.test(wp.url) ? wp.url : `http://${wp.url}`;
6
- if(url.endsWith('/')) url = url.slice(0, -1);
7
+ const isFE = app.projectType == 'fe';
7
8
  if(isWP) {
9
+ let url = /^https?:\/\//.test(wp.url) ? wp.url : `http://${wp.url}`;
10
+ if(url.endsWith('/')) url = url.slice(0, -1);
8
11
  print(`const wp = {
9
12
  directoryName: 'wp',
10
13
  themeName: '${app.nameSlug}-chisel',
@@ -15,6 +18,7 @@ const creatorData = <%= JSON.stringify(creatorData) %>;
15
18
 
16
19
  module.exports = {
17
20
  creatorData,
21
+
18
22
  <%= !isWP ? '' : `
19
23
  wp,
20
24
 
@@ -22,15 +26,23 @@ module.exports = {
22
26
  base: \`\${wp.directoryName}/wp-content/themes/\${wp.themeName}/dist\`
23
27
  },` %>
24
28
 
25
- // To use React and hot reload for react components:
29
+ <%= !isFE ? '' : `
30
+ staticFrontend: {
31
+ serveDist: ${String(fe.additionalFeatures.includes('serveDist'))},
32
+ skipHtmlExtension: ${String(fe.additionalFeatures.includes('skipHtmlExtension'))},
33
+ },
34
+ ` %>
35
+
36
+ // To use React and hot reload for React components:
26
37
  // 1. Run `yarn add react-hot-loader @hot-loader/react-dom`
27
38
  // 3. Mark your root component as hot-exported as described on
28
- // https://github.com/gaearon/react-hot-loader
39
+ // https://github.com/gaearon/react-hot-loader#getting-started (step 2)
29
40
  // 4. Uncomment line below
30
41
  // react: true,
31
42
 
32
43
  plugins: [
33
44
  'chisel-plugin-code-style',
34
45
  <%= isWP ? "'chisel-plugin-wordpress'," : '' %>
35
- ]
46
+ <%= isFE ? "'chisel-plugin-static-frontend'," : '' %>
47
+ ],
36
48
  }
@@ -1,6 +1,5 @@
1
1
  <% /* This file will be later formatted and sorted */ %>
2
2
  <% /* Don't worry too much how it looks here */ %>
3
- <% /* TOOD: precommit */ %>
4
3
  {
5
4
  "name": "<%= app.nameSlug %>",
6
5
  "version": "0.0.0",
@@ -13,14 +12,15 @@
13
12
  "watch": "chisel-scripts dev",
14
13
  "build": "chisel-scripts lint && chisel-scripts build",
15
14
  "build-report": "chisel-scripts build --report",
16
- <%= app.projectType == 'wp-with-fe' && `"wp": "chisel-scripts wp",` %>
17
- <%= app.projectType == 'wp-with-fe' && `"add-page": "chisel-scripts add-page",` %>
15
+ <%= app.projectType == 'wp-with-fe' ? `"wp": "chisel-scripts wp",` : '' %>
16
+ "add-page": "chisel-scripts add-page",
18
17
  "lint": "chisel-scripts lint"
19
18
  },
20
19
  "devDependencies": {
21
- <%= app.projectType == 'wp-with-fe' && `"chisel-plugin-wordpress": "*",` %>
20
+ <%= app.projectType == 'wp-with-fe' ? `"chisel-plugin-wordpress": "*",` : '' %>
21
+ <%= app.projectType == 'fe' ? `"chisel-plugin-static-frontend": "*",` : '' %>
22
22
  "babel-preset-chisel": "*",
23
- "postcss-normalize": "^9.0.0",
23
+ "@jakub300/postcss-normalize": "^9.0.1",
24
24
  "autoprefixer": "^9.8.0",
25
25
  <% /* required by postcss-normalize for some reason */ %>
26
26
  "browserslist": "^4.12.0",
@@ -30,7 +30,7 @@
30
30
  "dependencies": {
31
31
  },
32
32
  "engines": {
33
- "node": "^10.13.0 || ^12"
33
+ "node": "^10.14.2 || ^12 || ^14"
34
34
  },
35
35
  "husky": {
36
36
  "hooks": {
@@ -3,6 +3,6 @@
3
3
  module.exports = {
4
4
  plugins: [
5
5
  require('autoprefixer')({ grid: 'autoplace' }),
6
- require('postcss-normalize')(),
6
+ require('@jakub300/postcss-normalize')(),
7
7
  ],
8
8
  };
@@ -7,13 +7,13 @@ blockquote {
7
7
  font-style: italic;
8
8
 
9
9
  p:first-child {
10
- &:before {
10
+ &::before {
11
11
  content: open-quote;
12
12
  }
13
13
  }
14
14
 
15
15
  p:last-child {
16
- &:after {
16
+ &::after {
17
17
  content: close-quote;
18
18
  }
19
19
  }
@@ -13,8 +13,8 @@ html {
13
13
 
14
14
  * {
15
15
  &,
16
- &:before,
17
- &:after {
16
+ &::before,
17
+ &::after {
18
18
  box-sizing: inherit;
19
19
  }
20
20
  }
@@ -10,7 +10,7 @@
10
10
  // }
11
11
 
12
12
  @mixin clearfix() {
13
- &:after {
13
+ &::after {
14
14
  content: '' !important;
15
15
  display: block !important;
16
16
  clear: both !important;
@@ -0,0 +1,147 @@
1
+ /* Project index styling */
2
+ html {
3
+ font-size: 1em;
4
+ line-height: 1.5;
5
+ }
6
+
7
+ @media (min-width: 768px) {
8
+ html {
9
+ font-size: 1.25em;
10
+ }
11
+ }
12
+
13
+ @media (min-width: 1024px) {
14
+ html {
15
+ font-size: 1.5em;
16
+ }
17
+ }
18
+
19
+ body {
20
+ background: #f2e9da;
21
+ background-image: repeating-linear-gradient(
22
+ 180deg,
23
+ transparent,
24
+ transparent 40px,
25
+ #eae3d7 40px,
26
+ #eae3d7 41px
27
+ ),
28
+ repeating-linear-gradient(
29
+ 90deg,
30
+ transparent,
31
+ transparent 40px,
32
+ #eae3d7 40px,
33
+ #eae3d7 41px
34
+ );
35
+ color: #1b3729;
36
+ font-family: 'Crimson Text', serif;
37
+ padding: 1em;
38
+ }
39
+
40
+ a,
41
+ a:link {
42
+ color: #b08b31;
43
+ }
44
+
45
+ a:hover {
46
+ color: #ecbb42;
47
+ }
48
+
49
+ p {
50
+ margin: 0 0 1em 0;
51
+ }
52
+
53
+ /* Layouts */
54
+ .c-wrapper {
55
+ margin: 0 auto;
56
+ max-width: 860px;
57
+ }
58
+
59
+ .c-section {
60
+ margin-top: 2em;
61
+ }
62
+
63
+ .c-section__note {
64
+ margin-top: 1em;
65
+ }
66
+
67
+ .c-section__note:not(:last-child) {
68
+ display: none;
69
+ }
70
+
71
+ /* Header */
72
+ .c-page-title {
73
+ margin: 0;
74
+ }
75
+
76
+ .c-page-subtitle {
77
+ border-bottom: 7px solid #1b3729;
78
+ display: inline-block;
79
+ font-size: 1.25rem;
80
+ font-weight: 600;
81
+ margin: 0;
82
+ padding-bottom: 0.25em;
83
+ }
84
+
85
+ .c-intro {
86
+ font-size: 1.25rem;
87
+ margin: 0 1em 1em 0;
88
+ line-height: 1.5;
89
+ font-weight: 600;
90
+ }
91
+
92
+ /* Headings */
93
+ .c-heading {
94
+ border-bottom: 5px solid #ecbb42;
95
+ display: inline-block;
96
+ font-weight: 600;
97
+ margin: 0 0 0.5em 0;
98
+ }
99
+
100
+ /* Lists */
101
+ .c-list {
102
+ list-style: none;
103
+ margin: 0;
104
+ padding: 0;
105
+ }
106
+
107
+ .c-list li {
108
+ margin-bottom: 0.5em;
109
+ padding-left: 1em;
110
+ position: relative;
111
+ }
112
+
113
+ .c-list li::before {
114
+ background: #ecbb42;
115
+ content: '';
116
+ display: block;
117
+ height: 0.5em;
118
+ left: 0;
119
+ position: absolute;
120
+ top: 0.5em;
121
+ width: 0.5em;
122
+ }
123
+
124
+ /* Pages list */
125
+ .c-page {
126
+ text-decoration: none;
127
+ position: relative;
128
+ display: block;
129
+ border-bottom: 1px dashed #ccc;
130
+ padding-bottom: 0.5em;
131
+ }
132
+
133
+ .c-page__link {
134
+ text-decoration: underline;
135
+ }
136
+
137
+ .c-page__name {
138
+ color: #1b3729;
139
+ margin-left: 0.5em;
140
+ position: absolute;
141
+ top: 0;
142
+ right: 0;
143
+ }
144
+
145
+ .c-page:hover .c-page__name {
146
+ color: #999;
147
+ }
@@ -0,0 +1,51 @@
1
+ const { runLocal } = require('chisel-shared-utils');
2
+
3
+ module.exports = (api) => {
4
+ const runLocalCurrent = (args, opts) =>
5
+ runLocal(args, { ...opts, cwd: api.resolve() });
6
+
7
+ api.schedule(api.PRIORITIES.PROMPT, async () => {
8
+ await api.prompt([
9
+ {
10
+ type: 'checkbox',
11
+ name: 'additionalFeatures',
12
+ message: 'Additional features:',
13
+ choices: [
14
+ {
15
+ value: 'serveDist',
16
+ name: "Serve dist directory in dev / don't generate pages index",
17
+ },
18
+ {
19
+ value: 'skipHtmlExtension',
20
+ name:
21
+ "Don't include html extension in links (posts API) & support them in dev",
22
+ },
23
+ ],
24
+ },
25
+ ]);
26
+ });
27
+
28
+ api.schedule(api.PRIORITIES.COPY, async () => {
29
+ await api.copy();
30
+
31
+ if (!api.creator.data.fe.additionalFeatures.includes('serveDist')) {
32
+ await api.copy({ from: 'template-index' });
33
+
34
+ // lodash escaping seems to be broken, we use custom one
35
+ await api.modifyFile('index.html', (file) => {
36
+ return file.replace(/<\\%/g, '<%');
37
+ });
38
+ }
39
+
40
+ api.schedule(api.PRIORITIES.FE_ADD_INDEX, async () => {
41
+ if (api.creator.cmd.skipFeAddIndex) return;
42
+ if (!api.creator.data.fe.additionalFeatures.includes('serveDist')) return;
43
+
44
+ console.log('Adding index.twig page...');
45
+ await runLocalCurrent(
46
+ ['chisel-scripts', 'add-page', 'Index', '--no-build'],
47
+ { execaOpts: { stdio: 'inherit' } },
48
+ );
49
+ });
50
+ });
51
+ };
@@ -0,0 +1,3 @@
1
+ {
2
+ "attr-lowercase": ["viewBox", "preserveAspectRatio"]
3
+ }
@@ -0,0 +1,77 @@
1
+ <!DOCTYPE html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="utf-8" />
5
+ <title>Project Index - <%= app.name %></title>
6
+ <meta name="viewport" content="width=device-width, initial-scale=1">
7
+ <link
8
+ rel="stylesheet"
9
+ href="https://fonts.googleapis.com/css?family=Quicksand:400,500,600,700"
10
+ >
11
+ <!-- prettier-ignore -->
12
+ <style>
13
+ html{font-size:1em;line-height:1.5}@media (min-width:768px){html{font-size:1.25em}}@media (min-width:1024px){html{font-size:1.5em}}body{background:#fff;color:#2a1468;font-family:Quicksand,sans-serif;padding:1em}a,a:link{color:#2a1468;text-decoration:underline}a:hover{color:#ff6d54}p{margin:0 0 1em}.c-wrapper{margin:0 auto;max-width:860px}.c-section{margin-top:.5em}.c-section__content{font-size:.75em}.c-section__text a{font-weight:500}.c-section__intro{font-size:1em;font-weight:600}.c-section:last-child{margin-top:2em}.c-section__note{margin-top:1em}.c-section__note:not(:last-child){display:none}.c-page-title{margin:0;font-size:1.5em}.c-page-subtitle{margin:1.5em 0 0;font-size:1em}.c-heading,.c-page-subtitle{border-bottom:3px solid #ff6d54;display:inline-block;font-weight:600}.c-intro{font-size:1em;font-weight:600;margin:0 1em 1.9em 0;line-height:1.5}.c-heading{margin:0 0 .5em;font-size:1.35em}.c-list{list-style:none;margin:0;padding:0}.c-list li{margin-bottom:.5em;padding-left:1em;position:relative}.c-list li::before{background:#ff6d54;content:"";display:block;height:.5em;left:0;position:absolute;top:.5em;width:.5em}.c-page{text-decoration:none;position:relative;display:block;border-bottom:1px dashed #ccc;padding-bottom:.5em}.c-page__link{font-weight:600}.c-page__name{color:#2a1468;margin-left:.5em;position:absolute;top:0;right:0}.c-page:hover .c-page__name{color:#ff6d54}.c-section__code{padding:.9rem .8rem;overflow:auto;display:block;background:#2d2b57;color:#e3dfff;border-radius:10px}
14
+ </style>
15
+ <script type="text/x-chisel-pages-template">
16
+ <ul class="c-list">
17
+ <!-- CHISEL-PAGES -->
18
+ </ul>
19
+ </script>
20
+ <script type="text/x-chisel-page-template">
21
+ <li>
22
+ <a href="dist/<\%= page.path %>" class="c-page">
23
+ <span class="c-page__link"><\%= page.name %></span>
24
+ <span class="c-page__name"><\%= page.slug %>.html</span>
25
+ </a>
26
+ </li>
27
+ </script>
28
+ </head>
29
+ <body>
30
+ <div class="c-wrapper">
31
+ <h1 class="c-page-title"><%= app.name %></h1>
32
+ <h2 class="c-page-subtitle">Project index</h2>
33
+
34
+ <div class="c-section c-section--first">
35
+ <div class="c-section__content">
36
+ <p class="c-intro">
37
+ This project is powered by
38
+ <a href="https://www.getchisel.co/">Chisel</a>, a development
39
+ framework for creating easy to maintain and fast front-end
40
+ templates.
41
+ </p>
42
+ <h2 class="c-heading">Pages</h2>
43
+ <div class="c-section__note">
44
+ To add more pages run:
45
+ <pre><code class="c-section__code">npm run add-page 'My Awesome Page'</code></pre>
46
+ or
47
+ <pre><code class="c-section__code">yarn add-page 'My Awesome Page'</code></pre>
48
+ </div>
49
+ <!-- CHISEL-PAGES-LIST -->
50
+ </div>
51
+ </div>
52
+ <!-- /c-section -->
53
+
54
+ <section class="c-section">
55
+ <div class="c-section__content">
56
+ <h2 class="c-heading">Documentation</h2>
57
+ <p>
58
+ <strong class="c-section__intro">Chisel supports modern web development workflows and helps
59
+ developers to create a code base which is easy to
60
+ maintain.</strong>
61
+ </p>
62
+ <p class="c-section__text">
63
+ For detailed information how Chisel works, please check out
64
+ <a href="https://www.getchisel.co/">www.getchisel.co</a>.
65
+ </p>
66
+ <p class="c-section__text">
67
+ If you are just looking for your deliverable files, they are located
68
+ inside the <code>dist</code> folder. No files found outside of that
69
+ folder should usually be uploaded to your server (e.g. this file).
70
+ </p>
71
+ </div>
72
+ </section>
73
+ <!-- /c-section -->
74
+ </div>
75
+ <!-- /c-wrapper -->
76
+ </body>
77
+ </html>
@@ -0,0 +1,13 @@
1
+ diff a/packages/generator-chisel/lib/commands/create/creators/fe/template-index/index.chisel-tpl.html b/packages/generator-chisel/lib/commands/create/creators/fe/template-index/index.chisel-tpl.html (rejected hunks)
2
+ @@ -10,7 +10,11 @@
3
+ >
4
+ <!-- prettier-ignore -->
5
+ <style>
6
+ ++<<<<<<< HEAD
7
+ + html{font-size:1em;line-height:1.5}@media (min-width:768px){html{font-size:1.25em}}@media (min-width:1024px){html{font-size:1.5em}}body{background:#fff;color:#2a1468;font-family:Quicksand,sans-serif;padding:1em}a,a:link{color:#2a1468;text-decoration:underline}a:hover{color:#ff6d54}p{margin:0 0 1em}.c-wrapper{margin:0 auto;max-width:860px}.c-section{margin-top:.5em}.c-section__content{font-size:.75em}.c-section__text a{font-weight:500}.c-section__intro{font-size:1em;font-weight:600}.c-section:last-child{margin-top:2em}.c-section__note{margin-top:1em}.c-section__note:not(:last-child){display:none}.c-page-title{margin:0;font-size:1.5em}.c-page-subtitle{margin:1.5em 0 0;font-size:1em}.c-heading,.c-page-subtitle{border-bottom:3px solid #ff6d54;display:inline-block;font-weight:600}.c-intro{font-size:1em;font-weight:600;margin:0 1em 1.9em 0;line-height:1.5}.c-heading{margin:0 0 .5em;font-size:1.35em}.c-list{list-style:none;margin:0;padding:0}.c-list li{margin-bottom:.5em;padding-left:1em;position:relative}.c-list li:before{background:#ff6d54;content:"";display:block;height:.5em;left:0;position:absolute;top:.5em;width:.5em}.c-page{text-decoration:none;position:relative;display:block;border-bottom:1px dashed #ccc;padding-bottom:.5em}.c-page__link{font-weight:600}.c-page__name{color:#2a1468;margin-left:.5em;position:absolute;top:0;right:0}.c-page:hover .c-page__name{color:#ff6d54}.c-section__code{padding:.9rem .8rem;overflow:auto;display:block;background:#2d2b57;color:#e3dfff;border-radius:10px}
8
+ ++=======
9
+ + html{font-size:1em;line-height:1.5}@media (min-width: 768px){html{font-size:1.25em}}@media (min-width: 1024px){html{font-size:1.5em}}body{background:#fff;color:#2a1468;font-family:Quicksand,sans-serif;padding:1em}a,a:link{color:#2a1468;text-decoration:underline}a:hover{color:#ff6d54}p{margin:0 0 1em}.c-wrapper{margin:0 auto;max-width:860px}.c-section{margin-top:0.5em}.c-section__content{font-size:0.75em}.c-section__text a{font-weight:500}.c-section__intro{font-size:1em;font-weight:600}.c-section:last-child{margin-top:2em}.c-section__note{margin-top:1em}.c-section__note:not(:last-child){display:none}.c-page-title{margin:0;font-size:1.5em}.c-page-subtitle{margin:1.5em 0 0;font-size:1em}.c-page-subtitle,.c-heading{border-bottom:3px solid #ff6d54;display:inline-block;font-weight:600}.c-intro{font-size:1em;font-weight:600;margin:0 1em 1.9em 0;line-height:1.5}.c-heading{margin:0 0 0.5em;font-size:1.35em}.c-list{list-style:none;margin:0;padding:0}.c-list li{margin-bottom:0.5em;padding-left:1em;position:relative}.c-list li:before{background:#ff6d54;content:"";display:block;height:0.5em;left:0;position:absolute;top:0.5em;width:0.5em}.c-page{text-decoration:none;position:relative;display:block;border-bottom:1px dashed #ccc;padding-bottom:0.5em}.c-page__link{font-weight:600}.c-page__name{color:#2a1468;margin-left:0.5em;position:absolute;top:0;right:0}.c-page:hover .c-page__name{color:#ff6d54}.c-section__code{padding:0.9rem 0.8rem;overflow:auto;display:block;background:#2d2b57;color:#e3dfff;border-radius:10px}
10
+ ++>>>>>>> Minimize index styles
11
+ </style>
12
+ <script type="text/x-chisel-pages-template">
13
+ <ul class="c-list">
@@ -24,6 +24,7 @@ module.exports = async (api) => {
24
24
  }
25
25
 
26
26
  api.schedule(api.PRIORITIES.HELLO, async () => {
27
+ if (process.env.CHISEL_TEST) return;
27
28
  console.log();
28
29
  console.log(chalk.yellow('*'.repeat(47)));
29
30
  console.log();
@@ -37,6 +38,8 @@ module.exports = async (api) => {
37
38
  });
38
39
 
39
40
  api.schedule(api.PRIORITIES.CHECK_UPDATE, async () => {
41
+ if (process.env.CHISEL_TEST) return;
42
+
40
43
  const timeout = new Promise((_, reject) =>
41
44
  setTimeout(() => reject(new Error('timeout')), 5000),
42
45
  );
@@ -144,6 +144,8 @@ module.exports = (api) => {
144
144
  });
145
145
 
146
146
  api.schedule(api.PRIORITIES.WP_INSTALL_PLUGINS, async () => {
147
+ if (api.creator.cmd.skipWpCommands) return;
148
+
147
149
  await wp([
148
150
  'plugin',
149
151
  'install',
@@ -154,6 +156,8 @@ module.exports = (api) => {
154
156
  });
155
157
 
156
158
  api.schedule(api.PRIORITIES.WP_THEME_ACTIVATE, async () => {
159
+ if (api.creator.cmd.skipWpCommands) return;
160
+
157
161
  const { themeName } = require(api.resolve('chisel.config.js')).wp;
158
162
  await wp(['theme', 'activate', themeName]);
159
163
  });
@@ -0,0 +1,2 @@
1
+ /wp-content/uploads
2
+ /wp-config-local.php
@@ -1,10 +1,11 @@
1
1
  module.exports = {
2
- 'babel-preset-chisel': '1.0.0-alpha.0',
3
- 'chisel-plugin-code-style': '1.0.0-alpha.1',
4
- 'chisel-plugin-wordpress': '1.0.0-alpha.3',
5
- 'chisel-scripts': '1.0.0-alpha.2',
6
- 'chisel-shared-utils': '1.0.0-alpha.0',
7
- 'eslint-config-chisel': '3.0.0-alpha.0',
8
- 'generator-chisel': '1.0.0-alpha.6',
9
- 'stylelint-config-chisel': '1.0.0-alpha.0',
2
+ 'babel-preset-chisel': '1.0.0',
3
+ 'chisel-plugin-code-style': '1.0.0',
4
+ 'chisel-plugin-static-frontend': '1.0.0',
5
+ 'chisel-plugin-wordpress': '1.0.0',
6
+ 'chisel-scripts': '1.0.0',
7
+ 'chisel-shared-utils': '1.0.0',
8
+ 'eslint-config-chisel': '3.0.0',
9
+ 'generator-chisel': '1.0.0',
10
+ 'stylelint-config-chisel': '1.0.0',
10
11
  };
@@ -25,6 +25,7 @@ module.exports = {
25
25
 
26
26
  COPY_SECOND: 2000,
27
27
 
28
+ FE_ADD_INDEX: 2600,
28
29
  FORMAT: 2500,
29
30
 
30
31
  BUILD: 3000,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "generator-chisel",
3
- "version": "1.0.0-alpha.6",
3
+ "version": "1.0.0",
4
4
  "description": "A generator for scaffolding front-end and WordPress projects",
5
5
  "bin": {
6
6
  "chisel": "bin/chisel.js"
@@ -29,10 +29,10 @@
29
29
  "test": "bash test/run-tests.sh"
30
30
  },
31
31
  "engines": {
32
- "node": "^10.13.0 || ^12"
32
+ "node": "^10.13.0 || ^12 || ^14"
33
33
  },
34
34
  "dependencies": {
35
- "chisel-shared-utils": "^1.0.0-alpha.0",
35
+ "chisel-shared-utils": "^1.0.0",
36
36
  "commander": "^5.1.0",
37
37
  "execa": "^4.0.2",
38
38
  "fs-extra": "^9.0.1",
@@ -43,5 +43,5 @@
43
43
  "tinyqueue": "^2.0.3",
44
44
  "update-notifier": "^4.1.0"
45
45
  },
46
- "gitHead": "8f1b5c8170338475f533cfbb1da18e1aefa85204"
46
+ "gitHead": "a879e91b61e119d27439c9bd9e7298c89776a4fb"
47
47
  }