@nx/vue 17.0.0-beta.4

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 (99) hide show
  1. package/LICENSE +22 -0
  2. package/README.md +63 -0
  3. package/executors.json +3 -0
  4. package/generators.json +50 -0
  5. package/index.d.ts +11 -0
  6. package/index.js +21 -0
  7. package/migrations.json +4 -0
  8. package/package.json +54 -0
  9. package/src/generators/application/application.d.ts +4 -0
  10. package/src/generators/application/application.js +52 -0
  11. package/src/generators/application/files/common/index.html.template +13 -0
  12. package/src/generators/application/files/common/src/app/App.spec.ts.template +12 -0
  13. package/src/generators/application/files/common/src/app/App.vue.template +54 -0
  14. package/src/generators/application/files/common/src/app/NxWelcome.vue.template +793 -0
  15. package/src/generators/application/files/common/src/main.ts.template +15 -0
  16. package/src/generators/application/files/common/tsconfig.app.json.template +8 -0
  17. package/src/generators/application/files/routing/src/router/index.ts.template +23 -0
  18. package/src/generators/application/files/routing/src/views/AboutView.vue.template +16 -0
  19. package/src/generators/application/files/routing/src/views/HomeView.vue.template +9 -0
  20. package/src/generators/application/files/stylesheet/src/styles.__style__.template +42 -0
  21. package/src/generators/application/lib/add-e2e.d.ts +3 -0
  22. package/src/generators/application/lib/add-e2e.js +48 -0
  23. package/src/generators/application/lib/add-jest.d.ts +5 -0
  24. package/src/generators/application/lib/add-jest.js +22 -0
  25. package/src/generators/application/lib/add-vite.d.ts +3 -0
  26. package/src/generators/application/lib/add-vite.js +32 -0
  27. package/src/generators/application/lib/create-application-files.d.ts +3 -0
  28. package/src/generators/application/lib/create-application-files.js +30 -0
  29. package/src/generators/application/lib/normalize-options.d.ts +4 -0
  30. package/src/generators/application/lib/normalize-options.js +45 -0
  31. package/src/generators/application/schema.d.ts +30 -0
  32. package/src/generators/application/schema.json +140 -0
  33. package/src/generators/component/component.d.ts +4 -0
  34. package/src/generators/component/component.js +40 -0
  35. package/src/generators/component/files/__fileName__.spec.ts__tmpl__ +13 -0
  36. package/src/generators/component/files/__fileName__.vue__tmpl__ +10 -0
  37. package/src/generators/component/lib/utils.d.ts +7 -0
  38. package/src/generators/component/lib/utils.js +86 -0
  39. package/src/generators/component/schema.d.ts +22 -0
  40. package/src/generators/component/schema.json +107 -0
  41. package/src/generators/init/init.d.ts +4 -0
  42. package/src/generators/init/init.js +41 -0
  43. package/src/generators/init/schema.d.ts +7 -0
  44. package/src/generators/init/schema.json +37 -0
  45. package/src/generators/library/files/README.md +7 -0
  46. package/src/generators/library/files/package.json__tmpl__ +12 -0
  47. package/src/generators/library/files/src/index.ts__tmpl__ +0 -0
  48. package/src/generators/library/files/src/vue-shims.d.ts__tmpl__ +5 -0
  49. package/src/generators/library/files/tsconfig.lib.json__tmpl__ +34 -0
  50. package/src/generators/library/files/tsconfig.spec.json__tmpl__ +27 -0
  51. package/src/generators/library/lib/add-jest.d.ts +3 -0
  52. package/src/generators/library/lib/add-jest.js +23 -0
  53. package/src/generators/library/lib/add-vite.d.ts +3 -0
  54. package/src/generators/library/lib/add-vite.js +56 -0
  55. package/src/generators/library/lib/create-library-files.d.ts +3 -0
  56. package/src/generators/library/lib/create-library-files.js +28 -0
  57. package/src/generators/library/lib/normalize-options.d.ts +3 -0
  58. package/src/generators/library/lib/normalize-options.js +55 -0
  59. package/src/generators/library/library.d.ts +4 -0
  60. package/src/generators/library/library.js +71 -0
  61. package/src/generators/library/schema.d.ts +41 -0
  62. package/src/generators/library/schema.json +139 -0
  63. package/src/generators/setup-tailwind/files/postcss.config.js.template +10 -0
  64. package/src/generators/setup-tailwind/files/tailwind.config.js.template +18 -0
  65. package/src/generators/setup-tailwind/lib/add-tailwind-style-imports.d.ts +3 -0
  66. package/src/generators/setup-tailwind/lib/add-tailwind-style-imports.js +25 -0
  67. package/src/generators/setup-tailwind/schema.d.ts +6 -0
  68. package/src/generators/setup-tailwind/schema.json +45 -0
  69. package/src/generators/setup-tailwind/setup-tailwind.d.ts +4 -0
  70. package/src/generators/setup-tailwind/setup-tailwind.js +25 -0
  71. package/src/generators/stories/lib/component-story.d.ts +3 -0
  72. package/src/generators/stories/lib/component-story.js +34 -0
  73. package/src/generators/stories/lib/files/js/__componentFileName__.stories.js__tmpl__ +25 -0
  74. package/src/generators/stories/lib/files/ts/__componentFileName__.stories.ts__tmpl__ +32 -0
  75. package/src/generators/stories/lib/utils.d.ts +10 -0
  76. package/src/generators/stories/lib/utils.js +75 -0
  77. package/src/generators/stories/schema.json +64 -0
  78. package/src/generators/stories/stories.d.ts +13 -0
  79. package/src/generators/stories/stories.js +61 -0
  80. package/src/generators/storybook-configuration/configuration.d.ts +4 -0
  81. package/src/generators/storybook-configuration/configuration.js +35 -0
  82. package/src/generators/storybook-configuration/schema.d.ts +12 -0
  83. package/src/generators/storybook-configuration/schema.json +77 -0
  84. package/src/tailwind.d.ts +6 -0
  85. package/src/tailwind.js +29 -0
  86. package/src/utils/add-linting.d.ts +12 -0
  87. package/src/utils/add-linting.js +121 -0
  88. package/src/utils/ast-utils.d.ts +3 -0
  89. package/src/utils/ast-utils.js +33 -0
  90. package/src/utils/create-ts-config.d.ts +9 -0
  91. package/src/utils/create-ts-config.js +66 -0
  92. package/src/utils/lint.d.ts +9 -0
  93. package/src/utils/lint.js +26 -0
  94. package/src/utils/setup-jest.d.ts +4 -0
  95. package/src/utils/setup-jest.js +96 -0
  96. package/src/utils/test-utils.d.ts +3 -0
  97. package/src/utils/test-utils.js +30 -0
  98. package/src/utils/versions.d.ts +16 -0
  99. package/src/utils/versions.js +25 -0
package/LICENSE ADDED
@@ -0,0 +1,22 @@
1
+ (The MIT License)
2
+
3
+ Copyright (c) 2017-2023 Narwhal Technologies Inc.
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ 'Software'), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
19
+ IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
20
+ CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
21
+ TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
22
+ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,63 @@
1
+ <p style="text-align: center;"><img src="https://raw.githubusercontent.com/nrwl/nx/master/images/nx.png" width="600" alt="Nx - Smart, Fast and Extensible Build System"></p>
2
+
3
+ <div style="text-align: center;">
4
+
5
+ [![CircleCI](https://circleci.com/gh/nrwl/nx.svg?style=svg)](https://circleci.com/gh/nrwl/nx)
6
+ [![License](https://img.shields.io/npm/l/@nx/workspace.svg?style=flat-square)]()
7
+ [![NPM Version](https://badge.fury.io/js/%40nrwl%2Fworkspace.svg)](https://www.npmjs.com/@nx/workspace)
8
+ [![Semantic Release](https://img.shields.io/badge/%20%20%F0%9F%93%A6%F0%9F%9A%80-semantic--release-e10079.svg?style=flat-square)]()
9
+ [![Commitizen friendly](https://img.shields.io/badge/commitizen-friendly-brightgreen.svg)](http://commitizen.github.io/cz-cli/)
10
+ [![Join the chat at https://gitter.im/nrwl-nx/community](https://badges.gitter.im/nrwl-nx/community.svg)](https://gitter.im/nrwl-nx/community?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
11
+ [![Join us on the Official Nx Discord Server](https://img.shields.io/discord/1143497901675401286?label=discord)](https://go.nx.dev/community)
12
+
13
+ </div>
14
+
15
+
16
+ <hr>
17
+
18
+ # Nx: Smart, Fast and Extensible Build System
19
+
20
+ Nx is a next generation build system with first class monorepo support and powerful integrations.
21
+
22
+ This package is a [Vue plugin for Nx](https://nx.dev/packages/vue).
23
+
24
+ ## Getting Started
25
+
26
+ ### Creating an Nx Workspace
27
+
28
+ **Using `npx`**
29
+
30
+ ```bash
31
+ npx create-nx-workspace
32
+ ```
33
+
34
+ **Using `npm init`**
35
+
36
+ ```bash
37
+ npm init nx-workspace
38
+ ```
39
+
40
+ **Using `yarn create`**
41
+
42
+ ```bash
43
+ yarn create nx-workspace
44
+ ```
45
+
46
+ ### Adding Nx to an Existing Repository
47
+
48
+ Run:
49
+
50
+ ```bash
51
+ npx nx@latest init
52
+ ```
53
+
54
+ ## Documentation & Resources
55
+
56
+ - [Nx.Dev: Documentation, Guides, Tutorials](https://nx.dev)
57
+ - [Intro to Nx](https://nx.dev/getting-started/intro)
58
+ - [Official Nx YouTube Channel](https://www.youtube.com/@NxDevtools)
59
+ - [Blog Posts About Nx](https://blog.nrwl.io/nx/home)
60
+
61
+ <p style="text-align: center;"><a href="https://nx.dev/#learning-materials" target="_blank" rel="noreferrer"><img src="https://raw.githubusercontent.com/nrwl/nx/master/images/nx-courses-and-videos.svg"
62
+ width="100%" alt="Nx - Smart, Fast and Extensible Build System"></a></p>
63
+
package/executors.json ADDED
@@ -0,0 +1,3 @@
1
+ {
2
+ "executors": {}
3
+ }
@@ -0,0 +1,50 @@
1
+ {
2
+ "name": "Nx Vue",
3
+ "version": "0.1",
4
+ "generators": {
5
+ "init": {
6
+ "factory": "./src/generators/init/init",
7
+ "schema": "./src/generators/init/schema.json",
8
+ "description": "Initialize the `@nx/vue` plugin.",
9
+ "aliases": ["ng-add"],
10
+ "hidden": true
11
+ },
12
+ "application": {
13
+ "factory": "./src/generators/application/application",
14
+ "schema": "./src/generators/application/schema.json",
15
+ "aliases": ["app"],
16
+ "description": "Create a Vue application."
17
+ },
18
+ "library": {
19
+ "factory": "./src/generators/library/library",
20
+ "schema": "./src/generators/library/schema.json",
21
+ "aliases": ["lib"],
22
+ "x-type": "library",
23
+ "description": "Create a Vue library."
24
+ },
25
+ "component": {
26
+ "factory": "./src/generators/component/component",
27
+ "schema": "./src/generators/component/schema.json",
28
+ "aliases": ["c"],
29
+ "x-type": "component",
30
+ "description": "Create a Vue component."
31
+ },
32
+ "setup-tailwind": {
33
+ "factory": "./src/generators/setup-tailwind/setup-tailwind",
34
+ "schema": "./src/generators/setup-tailwind/schema.json",
35
+ "description": "Set up Tailwind configuration for a project."
36
+ },
37
+ "storybook-configuration": {
38
+ "factory": "./src/generators/storybook-configuration/configuration",
39
+ "schema": "./src/generators/storybook-configuration/schema.json",
40
+ "description": "Set up storybook for a Vue app or library.",
41
+ "hidden": false
42
+ },
43
+ "stories": {
44
+ "factory": "./src/generators/stories/stories",
45
+ "schema": "./src/generators/stories/schema.json",
46
+ "description": "Create stories for all components declared in an app or library.",
47
+ "hidden": false
48
+ }
49
+ }
50
+ }
package/index.d.ts ADDED
@@ -0,0 +1,11 @@
1
+ export * from './src/utils/versions';
2
+ export { applicationGenerator } from './src/generators/application/application';
3
+ export { libraryGenerator } from './src/generators/library/library';
4
+ export { componentGenerator } from './src/generators/component/component';
5
+ export { storybookConfigurationGenerator } from './src/generators/storybook-configuration/configuration';
6
+ export { storiesGenerator, StorybookStoriesSchema, } from './src/generators/stories/stories';
7
+ export { type InitSchema } from './src/generators/init/schema';
8
+ export { vueInitGenerator } from './src/generators/init/init';
9
+ export { addJest } from './src/generators/application/lib/add-jest';
10
+ export * from './src/utils/versions';
11
+ export * from './src/utils/add-linting';
package/index.js ADDED
@@ -0,0 +1,21 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.addJest = exports.vueInitGenerator = exports.storiesGenerator = exports.storybookConfigurationGenerator = exports.componentGenerator = exports.libraryGenerator = exports.applicationGenerator = void 0;
4
+ const tslib_1 = require("tslib");
5
+ tslib_1.__exportStar(require("./src/utils/versions"), exports);
6
+ var application_1 = require("./src/generators/application/application");
7
+ Object.defineProperty(exports, "applicationGenerator", { enumerable: true, get: function () { return application_1.applicationGenerator; } });
8
+ var library_1 = require("./src/generators/library/library");
9
+ Object.defineProperty(exports, "libraryGenerator", { enumerable: true, get: function () { return library_1.libraryGenerator; } });
10
+ var component_1 = require("./src/generators/component/component");
11
+ Object.defineProperty(exports, "componentGenerator", { enumerable: true, get: function () { return component_1.componentGenerator; } });
12
+ var configuration_1 = require("./src/generators/storybook-configuration/configuration");
13
+ Object.defineProperty(exports, "storybookConfigurationGenerator", { enumerable: true, get: function () { return configuration_1.storybookConfigurationGenerator; } });
14
+ var stories_1 = require("./src/generators/stories/stories");
15
+ Object.defineProperty(exports, "storiesGenerator", { enumerable: true, get: function () { return stories_1.storiesGenerator; } });
16
+ var init_1 = require("./src/generators/init/init");
17
+ Object.defineProperty(exports, "vueInitGenerator", { enumerable: true, get: function () { return init_1.vueInitGenerator; } });
18
+ var add_jest_1 = require("./src/generators/application/lib/add-jest");
19
+ Object.defineProperty(exports, "addJest", { enumerable: true, get: function () { return add_jest_1.addJest; } });
20
+ tslib_1.__exportStar(require("./src/utils/versions"), exports);
21
+ tslib_1.__exportStar(require("./src/utils/add-linting"), exports);
@@ -0,0 +1,4 @@
1
+ {
2
+ "generators": {},
3
+ "packageJsonUpdates": {}
4
+ }
package/package.json ADDED
@@ -0,0 +1,54 @@
1
+ {
2
+ "name": "@nx/vue",
3
+ "version": "17.0.0-beta.4",
4
+ "private": false,
5
+ "description": "The Vue plugin for Nx contains executors and generators for managing Vue applications and libraries within an Nx workspace. It provides:\n\n\n- Integration with libraries such as Jest, Cypress, and Storybook.\n\n- Generators for applications, libraries, and more.\n\n- Library build support for publishing packages to npm or other registries.\n\n- Utilities for automatic workspace refactoring.",
6
+ "repository": {
7
+ "type": "git",
8
+ "url": "https://github.com/nrwl/nx.git",
9
+ "directory": "packages/vue"
10
+ },
11
+ "keywords": [
12
+ "Monorepo",
13
+ "Vue",
14
+ "Web",
15
+ "CLI"
16
+ ],
17
+ "main": "./index.js",
18
+ "typings": "./index.d.ts",
19
+ "author": "Victor Savkin",
20
+ "license": "MIT",
21
+ "bugs": {
22
+ "url": "https://github.com/nrwl/nx/issues"
23
+ },
24
+ "homepage": "https://nx.dev",
25
+ "generators": "./generators.json",
26
+ "executors": "./executors.json",
27
+ "nx-migrations": {
28
+ "migrations": "./migrations.json"
29
+ },
30
+ "dependencies": {
31
+ "minimatch": "3.0.5",
32
+ "tslib": "^2.3.0",
33
+ "@nx/devkit": "17.0.0-beta.4",
34
+ "@nx/jest": "17.0.0-beta.4",
35
+ "@nx/js": "17.0.0-beta.4",
36
+ "@nx/linter": "17.0.0-beta.4",
37
+ "@nx/vite": "17.0.0-beta.4",
38
+ "@nx/web": "17.0.0-beta.4",
39
+ "@phenomnomnominal/tsquery": "~5.0.1"
40
+ },
41
+ "publishConfig": {
42
+ "access": "public"
43
+ },
44
+ "peerDependencies": {},
45
+ "exports": {
46
+ "./package.json": "./package.json",
47
+ ".": "./index.js",
48
+ "./executors.json": "./executors.json",
49
+ "./generators.json": "./generators.json",
50
+ "./migrations.json": "./migrations.json",
51
+ "./tailwind": "./src/tailwind.js"
52
+ },
53
+ "type": "commonjs"
54
+ }
@@ -0,0 +1,4 @@
1
+ import { GeneratorCallback, Tree } from '@nx/devkit';
2
+ import { Schema } from './schema';
3
+ export declare function applicationGenerator(tree: Tree, _options: Schema): Promise<GeneratorCallback>;
4
+ export default applicationGenerator;
@@ -0,0 +1,52 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.applicationGenerator = void 0;
4
+ const devkit_1 = require("@nx/devkit");
5
+ const linter_1 = require("@nx/linter");
6
+ const normalize_options_1 = require("./lib/normalize-options");
7
+ const init_1 = require("../init/init");
8
+ const add_linting_1 = require("../../utils/add-linting");
9
+ const add_e2e_1 = require("./lib/add-e2e");
10
+ const create_application_files_1 = require("./lib/create-application-files");
11
+ const add_vite_1 = require("./lib/add-vite");
12
+ const add_jest_1 = require("./lib/add-jest");
13
+ const create_ts_config_1 = require("../../utils/create-ts-config");
14
+ async function applicationGenerator(tree, _options) {
15
+ const options = await (0, normalize_options_1.normalizeOptions)(tree, _options);
16
+ const tasks = [];
17
+ (0, devkit_1.addProjectConfiguration)(tree, options.name, {
18
+ root: options.appProjectRoot,
19
+ projectType: 'application',
20
+ sourceRoot: `${options.appProjectRoot}/src`,
21
+ targets: {},
22
+ });
23
+ tasks.push(await (0, init_1.vueInitGenerator)(tree, {
24
+ ...options,
25
+ skipFormat: true,
26
+ }));
27
+ (0, create_ts_config_1.extractTsConfigBase)(tree);
28
+ (0, create_application_files_1.createApplicationFiles)(tree, options);
29
+ tasks.push(await (0, add_linting_1.addLinting)(tree, {
30
+ name: options.projectName,
31
+ projectRoot: options.appProjectRoot,
32
+ linter: options.linter ?? linter_1.Linter.EsLint,
33
+ unitTestRunner: options.unitTestRunner,
34
+ skipPackageJson: options.skipPackageJson,
35
+ setParserOptionsProject: options.setParserOptionsProject,
36
+ rootProject: options.rootProject,
37
+ }, 'app'));
38
+ tasks.push(await (0, add_vite_1.addVite)(tree, options));
39
+ if (options.unitTestRunner === 'jest')
40
+ tasks.push(await (0, add_jest_1.addJest)(tree, {
41
+ name: options.name,
42
+ projectRoot: options.appProjectRoot,
43
+ }));
44
+ tasks.push(await (0, add_e2e_1.addE2e)(tree, options));
45
+ if (options.js)
46
+ (0, devkit_1.toJS)(tree);
47
+ if (!options.skipFormat)
48
+ await (0, devkit_1.formatFiles)(tree);
49
+ return (0, devkit_1.runTasksInSerial)(...tasks);
50
+ }
51
+ exports.applicationGenerator = applicationGenerator;
52
+ exports.default = applicationGenerator;
@@ -0,0 +1,13 @@
1
+ <!DOCTYPE html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="UTF-8">
5
+ <link rel="icon" href="/favicon.ico">
6
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
7
+ <title><%= title %></title>
8
+ </head>
9
+ <body>
10
+ <div id="root"></div>
11
+ <script type="module" src="/src/main.ts"></script>
12
+ </body>
13
+ </html>
@@ -0,0 +1,12 @@
1
+ <% if ( unitTestRunner === 'vitest' ) { %>
2
+ import { describe, it, expect } from 'vitest'
3
+ <% } %>
4
+ import { mount } from '@vue/test-utils'
5
+ import App from './App.vue';
6
+
7
+ describe('App', () => {
8
+ it('renders properly', () => {
9
+ const wrapper = mount(App, {})
10
+ expect(wrapper.text()).toContain('Welcome <%= title %> 👋')
11
+ })
12
+ });
@@ -0,0 +1,54 @@
1
+ <script setup lang="ts">
2
+ <% if (routing) { %>
3
+ import { RouterLink, RouterView } from 'vue-router';
4
+ <% } else { %>
5
+ import NxWelcome from './NxWelcome.vue';
6
+ <% } %>
7
+ </script>
8
+
9
+ <template>
10
+ <% if (routing) { %>
11
+ <header>
12
+ <nav>
13
+ <RouterLink to="/">Home</RouterLink>
14
+ <RouterLink to="/about">About</RouterLink>
15
+ </nav>
16
+ </header>
17
+ <RouterView />
18
+ <% } else { %>
19
+ <NxWelcome title="<%= title %>" />
20
+ <% } %>
21
+ </template>
22
+
23
+ <% if (routing && style !== 'none') { %>
24
+ <style scoped lang="<%= style %>">
25
+ header {
26
+ line-height: 1.5;
27
+ max-width: 100vw;
28
+ }
29
+
30
+ nav > a {
31
+ padding-left: 1rem;
32
+ padding-right: 1rem;
33
+ }
34
+
35
+ @media (min-width: 768px) {
36
+ header {
37
+ display: flex;
38
+ place-items: center;
39
+ padding-right: calc(var(--section-gap) / 2);
40
+ margin-left: auto;
41
+ margin-right: auto;
42
+ max-width: 768px;
43
+ }
44
+
45
+ nav {
46
+ text-align: left;
47
+ font-size: 1rem;
48
+
49
+ padding: 1rem 0;
50
+ margin-top: 1rem;
51
+ }
52
+ }
53
+ </style>
54
+ <% } %>