@community-release/nx-ui 0.0.9 → 0.0.10

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.
package/dist/module.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "ui",
3
3
  "configKey": "ui",
4
- "version": "0.0.9"
4
+ "version": "0.0.10"
5
5
  }
package/dist/module.mjs CHANGED
@@ -1,17 +1,6 @@
1
1
  import { defineNuxtModule, createResolver, addTemplate, addPlugin, addComponentsDir, addComponent } from '@nuxt/kit';
2
2
  import fs from 'node:fs';
3
- import path from 'node:path';
4
- import { fileURLToPath } from 'node:url';
5
3
 
6
-
7
-
8
- // -- Unbuild CommonJS Shims --
9
- import __cjs_url__ from 'url';
10
- import __cjs_path__ from 'path';
11
- import __cjs_mod__ from 'module';
12
- const __filename = __cjs_url__.fileURLToPath(import.meta.url);
13
- const __dirname = __cjs_path__.dirname(__filename);
14
- const require = __cjs_mod__.createRequire(import.meta.url);
15
4
  const defaultStyle = {
16
5
  "content-width": "1400px",
17
6
  // website content width
@@ -127,15 +116,14 @@ const generateComponentsDefaults = (options) => {
127
116
  return result;
128
117
  };
129
118
 
130
- const __dirname__ = path.dirname(fileURLToPath(import.meta.url));
131
- const readComponentsProps = (options = {}) => {
132
- const dirComponents = path.resolve(__dirname__, "../runtime/components/");
119
+ const readComponentsProps = (resolve, srcDir, options = {}) => {
120
+ const dirComponents = resolve(srcDir, "./runtime/components/");
133
121
  const result = {};
134
122
  let files = fs.readdirSync(dirComponents, { recursive: true });
135
123
  files = files.filter((v) => v.indexOf("props.json") !== -1);
136
124
  for (let file of files) {
137
125
  const componentName = file.split("\\")[0];
138
- const propsJSON = fs.readFileSync(path.resolve(dirComponents, file), { encoding: "utf-8" });
126
+ const propsJSON = fs.readFileSync(resolve(dirComponents, file), { encoding: "utf-8" });
139
127
  const props = JSON.parse(propsJSON);
140
128
  result[componentName] = props;
141
129
  }
@@ -167,18 +155,19 @@ const module = defineNuxtModule({
167
155
  defaults: {},
168
156
  setup(options, nuxt) {
169
157
  const { resolve } = createResolver(import.meta.url);
158
+ const srcDir = resolve("./");
170
159
  addTemplate({
171
160
  filename: "ui.style.mjs",
172
161
  getContents: () => "export default " + JSON.stringify(generateStyle(options))
173
162
  //write: true
174
163
  });
175
164
  addTemplate({
176
- dst: resolve(".runtime/components/styles/components.less"),
165
+ dst: resolve("./runtime/components/styles/components.less"),
177
166
  write: true,
178
167
  filename: "components.less",
179
168
  getContents: () => generateComponentsDefaults(options)
180
169
  });
181
- const componentsProps = readComponentsProps(options);
170
+ const componentsProps = readComponentsProps(resolve, srcDir, options);
182
171
  for (let componentName in componentsProps) {
183
172
  addTemplate({
184
173
  filename: `ui.${componentName}.mjs`,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@community-release/nx-ui",
3
- "version": "0.0.9",
3
+ "version": "0.0.10",
4
4
  "description": "nx-ui - Nuxt UI library",
5
5
  "repository": {
6
6
  "type": "git",