ember-codemod-remove-ember-css-modules 0.3.1 → 0.4.1
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/README.md +1 -1
- package/dist/src/migration/ember-app/steps/analyze-app/analyze-components.js +43 -0
- package/dist/src/migration/ember-app/steps/analyze-app/analyze-file-paths.js +16 -0
- package/dist/src/migration/ember-app/steps/analyze-app/analyze-routes.js +38 -0
- package/dist/src/migration/ember-app/steps/analyze-app/index.js +2 -0
- package/dist/src/migration/ember-app/steps/analyze-app.js +1 -93
- package/dist/src/migration/ember-app/steps/import-styles/create-class.js +25 -0
- package/dist/src/migration/ember-app/steps/import-styles/index.js +16 -0
- package/dist/src/migration/ember-app/steps/{shared/import-styles.js → import-styles/update-class.js} +7 -38
- package/dist/src/migration/ember-app/steps/import-styles-in-components.js +1 -1
- package/dist/src/migration/ember-app/steps/import-styles-in-routes.js +1 -1
- package/dist/src/migration/ember-app/steps/update-app-app-js.js +1 -1
- package/dist/src/migration/ember-app/steps/update-component-templates.js +1 -1
- package/dist/src/migration/ember-app/steps/update-package-json.js +10 -1
- package/dist/src/migration/ember-app/steps/update-route-templates.js +1 -1
- package/dist/src/migration/ember-app/steps/update-templates/index.js +10 -0
- package/dist/src/migration/ember-app/steps/{shared/update-templates.js → update-templates/update-template.js} +2 -11
- package/dist/src/utils/blueprints/get-version.js +9 -3
- package/package.json +9 -7
- package/dist/src/utils/string/ember-cli-string-utils/camelize.js +0 -11
- package/dist/src/utils/string/ember-cli-string-utils/classify.js +0 -10
- package/dist/src/utils/string/entity-name/classify.js +0 -5
- package/dist/src/utils/string/entity-name/double-colonize.js +0 -7
- package/dist/src/utils/string/entity-name/parse.js +0 -15
- package/dist/src/utils/string.js +0 -5
package/README.md
CHANGED
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { findFiles, renamePathByDirectory } from '@codemod-utils/files';
|
|
2
|
+
import { analyzeFilePaths } from './analyze-file-paths.js';
|
|
3
|
+
export function analyzeComponents(options) {
|
|
4
|
+
const { componentStructure, projectRoot } = options;
|
|
5
|
+
const classFilePaths = findFiles('app/components/**/*.{js,ts}', {
|
|
6
|
+
ignoreList: ['app/components/**/*.d.ts'],
|
|
7
|
+
projectRoot,
|
|
8
|
+
}).map((filePath) => {
|
|
9
|
+
return renamePathByDirectory(filePath, {
|
|
10
|
+
from: 'app/components',
|
|
11
|
+
to: '',
|
|
12
|
+
});
|
|
13
|
+
});
|
|
14
|
+
const stylesheetFilePaths = findFiles('app/components/**/*.css', {
|
|
15
|
+
projectRoot,
|
|
16
|
+
}).map((filePath) => {
|
|
17
|
+
return renamePathByDirectory(filePath, {
|
|
18
|
+
from: 'app/components',
|
|
19
|
+
to: '',
|
|
20
|
+
});
|
|
21
|
+
});
|
|
22
|
+
const templateFilePaths = findFiles('app/components/**/*.hbs', {
|
|
23
|
+
projectRoot,
|
|
24
|
+
}).map((filePath) => {
|
|
25
|
+
return renamePathByDirectory(filePath, {
|
|
26
|
+
from: 'app/components',
|
|
27
|
+
to: '',
|
|
28
|
+
});
|
|
29
|
+
});
|
|
30
|
+
const filePaths = [
|
|
31
|
+
...classFilePaths,
|
|
32
|
+
...stylesheetFilePaths,
|
|
33
|
+
...templateFilePaths,
|
|
34
|
+
].sort();
|
|
35
|
+
const entities = analyzeFilePaths(filePaths);
|
|
36
|
+
if (componentStructure === 'nested') {
|
|
37
|
+
return new Map(Array.from(entities.entries()).map(([entityName, extensions]) => {
|
|
38
|
+
const newEntityName = entityName.replace(/\/index$/, '');
|
|
39
|
+
return [newEntityName, extensions];
|
|
40
|
+
}));
|
|
41
|
+
}
|
|
42
|
+
return entities;
|
|
43
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { join } from 'node:path';
|
|
2
|
+
import { parseFilePath } from '@codemod-utils/files';
|
|
3
|
+
export function analyzeFilePaths(filePaths) {
|
|
4
|
+
const entities = new Map();
|
|
5
|
+
filePaths.forEach((filePath) => {
|
|
6
|
+
const { dir, ext, name } = parseFilePath(filePath);
|
|
7
|
+
const entityName = join(dir, name);
|
|
8
|
+
if (entities.has(entityName)) {
|
|
9
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
10
|
+
entities.get(entityName).add(ext);
|
|
11
|
+
return;
|
|
12
|
+
}
|
|
13
|
+
entities.set(entityName, new Set([ext]));
|
|
14
|
+
});
|
|
15
|
+
return entities;
|
|
16
|
+
}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { findFiles, renamePathByDirectory } from '@codemod-utils/files';
|
|
2
|
+
import { analyzeFilePaths } from './analyze-file-paths.js';
|
|
3
|
+
export function analyzeRoutes(options) {
|
|
4
|
+
const { projectRoot } = options;
|
|
5
|
+
const classFilePaths = findFiles('app/controllers/**/*.{js,ts}', {
|
|
6
|
+
ignoreList: ['app/controllers/**/*.d.ts'],
|
|
7
|
+
projectRoot,
|
|
8
|
+
}).map((filePath) => {
|
|
9
|
+
return renamePathByDirectory(filePath, {
|
|
10
|
+
from: 'app/controllers',
|
|
11
|
+
to: '',
|
|
12
|
+
});
|
|
13
|
+
});
|
|
14
|
+
const stylesheetFilePaths = findFiles('app/styles/**/*.css', {
|
|
15
|
+
ignoreList: ['app/styles/app.css'],
|
|
16
|
+
projectRoot,
|
|
17
|
+
}).map((filePath) => {
|
|
18
|
+
return renamePathByDirectory(filePath, {
|
|
19
|
+
from: 'app/styles',
|
|
20
|
+
to: '',
|
|
21
|
+
});
|
|
22
|
+
});
|
|
23
|
+
const templateFilePaths = findFiles('app/templates/**/*.hbs', {
|
|
24
|
+
ignoreList: ['app/templates/components/**/*'],
|
|
25
|
+
projectRoot,
|
|
26
|
+
}).map((filePath) => {
|
|
27
|
+
return renamePathByDirectory(filePath, {
|
|
28
|
+
from: 'app/templates',
|
|
29
|
+
to: '',
|
|
30
|
+
});
|
|
31
|
+
});
|
|
32
|
+
const filePaths = [
|
|
33
|
+
...classFilePaths,
|
|
34
|
+
...stylesheetFilePaths,
|
|
35
|
+
...templateFilePaths,
|
|
36
|
+
].sort();
|
|
37
|
+
return analyzeFilePaths(filePaths);
|
|
38
|
+
}
|
|
@@ -1,96 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { findFiles, renamePathByDirectory } from '@codemod-utils/files';
|
|
3
|
-
function analyzeFilePaths(filePaths) {
|
|
4
|
-
const entities = new Map();
|
|
5
|
-
filePaths.forEach((filePath) => {
|
|
6
|
-
const { dir, ext, name } = parse(filePath);
|
|
7
|
-
const entityName = join(dir, name);
|
|
8
|
-
if (entities.has(entityName)) {
|
|
9
|
-
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
10
|
-
entities.get(entityName).add(ext);
|
|
11
|
-
return;
|
|
12
|
-
}
|
|
13
|
-
entities.set(entityName, new Set([ext]));
|
|
14
|
-
});
|
|
15
|
-
return entities;
|
|
16
|
-
}
|
|
17
|
-
function analyzeComponents(options) {
|
|
18
|
-
const { componentStructure, projectRoot } = options;
|
|
19
|
-
const classFilePaths = findFiles('app/components/**/*.{js,ts}', {
|
|
20
|
-
ignoreList: ['app/components/**/*.d.ts'],
|
|
21
|
-
projectRoot,
|
|
22
|
-
}).map((filePath) => {
|
|
23
|
-
return renamePathByDirectory(filePath, {
|
|
24
|
-
from: 'app/components',
|
|
25
|
-
to: '',
|
|
26
|
-
});
|
|
27
|
-
});
|
|
28
|
-
const stylesheetFilePaths = findFiles('app/components/**/*.css', {
|
|
29
|
-
projectRoot,
|
|
30
|
-
}).map((filePath) => {
|
|
31
|
-
return renamePathByDirectory(filePath, {
|
|
32
|
-
from: 'app/components',
|
|
33
|
-
to: '',
|
|
34
|
-
});
|
|
35
|
-
});
|
|
36
|
-
const templateFilePaths = findFiles('app/components/**/*.hbs', {
|
|
37
|
-
projectRoot,
|
|
38
|
-
}).map((filePath) => {
|
|
39
|
-
return renamePathByDirectory(filePath, {
|
|
40
|
-
from: 'app/components',
|
|
41
|
-
to: '',
|
|
42
|
-
});
|
|
43
|
-
});
|
|
44
|
-
const filePaths = [
|
|
45
|
-
...classFilePaths,
|
|
46
|
-
...stylesheetFilePaths,
|
|
47
|
-
...templateFilePaths,
|
|
48
|
-
].sort();
|
|
49
|
-
const entities = analyzeFilePaths(filePaths);
|
|
50
|
-
if (componentStructure === 'nested') {
|
|
51
|
-
return new Map(Array.from(entities.entries()).map(([entityName, extensions]) => {
|
|
52
|
-
const newEntityName = entityName.replace(/\/index$/, '');
|
|
53
|
-
return [newEntityName, extensions];
|
|
54
|
-
}));
|
|
55
|
-
}
|
|
56
|
-
return entities;
|
|
57
|
-
}
|
|
58
|
-
function analyzeRoutes(options) {
|
|
59
|
-
const { projectRoot } = options;
|
|
60
|
-
const classFilePaths = findFiles('app/controllers/**/*.{js,ts}', {
|
|
61
|
-
ignoreList: ['app/controllers/**/*.d.ts'],
|
|
62
|
-
projectRoot,
|
|
63
|
-
}).map((filePath) => {
|
|
64
|
-
return renamePathByDirectory(filePath, {
|
|
65
|
-
from: 'app/controllers',
|
|
66
|
-
to: '',
|
|
67
|
-
});
|
|
68
|
-
});
|
|
69
|
-
const stylesheetFilePaths = findFiles('app/styles/**/*.css', {
|
|
70
|
-
ignoreList: ['app/styles/app.css'],
|
|
71
|
-
projectRoot,
|
|
72
|
-
}).map((filePath) => {
|
|
73
|
-
return renamePathByDirectory(filePath, {
|
|
74
|
-
from: 'app/styles',
|
|
75
|
-
to: '',
|
|
76
|
-
});
|
|
77
|
-
});
|
|
78
|
-
const templateFilePaths = findFiles('app/templates/**/*.hbs', {
|
|
79
|
-
ignoreList: ['app/templates/components/**/*'],
|
|
80
|
-
projectRoot,
|
|
81
|
-
}).map((filePath) => {
|
|
82
|
-
return renamePathByDirectory(filePath, {
|
|
83
|
-
from: 'app/templates',
|
|
84
|
-
to: '',
|
|
85
|
-
});
|
|
86
|
-
});
|
|
87
|
-
const filePaths = [
|
|
88
|
-
...classFilePaths,
|
|
89
|
-
...stylesheetFilePaths,
|
|
90
|
-
...templateFilePaths,
|
|
91
|
-
].sort();
|
|
92
|
-
return analyzeFilePaths(filePaths);
|
|
93
|
-
}
|
|
1
|
+
import { analyzeComponents, analyzeRoutes } from './analyze-app/index.js';
|
|
94
2
|
export function analyzeApp(options) {
|
|
95
3
|
return {
|
|
96
4
|
components: analyzeComponents(options),
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { readFileSync } from 'node:fs';
|
|
2
|
+
import { join } from 'node:path';
|
|
3
|
+
import { processTemplate } from '@codemod-utils/blueprints';
|
|
4
|
+
import { classify, doubleColonize } from '@codemod-utils/ember-cli-string';
|
|
5
|
+
import { createFiles, parseFilePath } from '@codemod-utils/files';
|
|
6
|
+
import { blueprintsRoot } from '../../../../utils/blueprints.js';
|
|
7
|
+
export function createClass(entityName, { customizations, options }) {
|
|
8
|
+
const { blueprintFilePaths, getFilePath } = customizations;
|
|
9
|
+
const entity = {
|
|
10
|
+
classifiedName: classify(entityName),
|
|
11
|
+
doubleColonizedName: doubleColonize(entityName),
|
|
12
|
+
fileName: parseFilePath(entityName).name,
|
|
13
|
+
name: entityName,
|
|
14
|
+
};
|
|
15
|
+
const filePath = getFilePath(entityName);
|
|
16
|
+
const fileMap = new Map(blueprintFilePaths.map((blueprintFilePath) => {
|
|
17
|
+
const blueprintFile = readFileSync(join(blueprintsRoot, blueprintFilePath), 'utf8');
|
|
18
|
+
const file = processTemplate(blueprintFile, {
|
|
19
|
+
entity,
|
|
20
|
+
options,
|
|
21
|
+
});
|
|
22
|
+
return [filePath, file];
|
|
23
|
+
}));
|
|
24
|
+
createFiles(fileMap, options);
|
|
25
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { createClass } from './create-class.js';
|
|
2
|
+
import { updateClass } from './update-class.js';
|
|
3
|
+
export function importStyles(entities, options) {
|
|
4
|
+
for (const [entityName, extensions] of entities) {
|
|
5
|
+
const hasClass = extensions.has('.js') || extensions.has('.ts');
|
|
6
|
+
const hasStylesheet = extensions.has('.css');
|
|
7
|
+
if (!hasStylesheet) {
|
|
8
|
+
continue;
|
|
9
|
+
}
|
|
10
|
+
if (!hasClass) {
|
|
11
|
+
createClass(entityName, options);
|
|
12
|
+
continue;
|
|
13
|
+
}
|
|
14
|
+
updateClass(entityName, options);
|
|
15
|
+
}
|
|
16
|
+
}
|
package/dist/src/migration/ember-app/steps/{shared/import-styles.js → import-styles/update-class.js}
RENAMED
|
@@ -1,11 +1,8 @@
|
|
|
1
1
|
/* eslint-disable @typescript-eslint/ban-ts-comment */
|
|
2
2
|
import { readFileSync } from 'node:fs';
|
|
3
|
-
import { join
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import { createFiles } from '@codemod-utils/files';
|
|
7
|
-
import { blueprintsRoot } from '../../../../utils/blueprints.js';
|
|
8
|
-
import { parseEntityName } from '../../../../utils/string.js';
|
|
3
|
+
import { join } from 'node:path';
|
|
4
|
+
import { AST } from '@codemod-utils/ast-javascript';
|
|
5
|
+
import { createFiles, parseFilePath } from '@codemod-utils/files';
|
|
9
6
|
function removeTemplateOnlyComponentMethod(file, data) {
|
|
10
7
|
const traverse = AST.traverse(data.isTypeScript);
|
|
11
8
|
const ast = traverse(file, {
|
|
@@ -80,29 +77,15 @@ function addStylesAsClassProperty(file, data) {
|
|
|
80
77
|
});
|
|
81
78
|
return AST.print(ast);
|
|
82
79
|
}
|
|
83
|
-
function
|
|
84
|
-
const { blueprintFilePaths, getFilePath } = customizations;
|
|
85
|
-
const entity = parseEntityName(entityName);
|
|
86
|
-
const filePath = getFilePath(entityName);
|
|
87
|
-
const fileMap = new Map(blueprintFilePaths.map((blueprintFilePath) => {
|
|
88
|
-
const blueprintFile = readFileSync(join(blueprintsRoot, blueprintFilePath), 'utf8');
|
|
89
|
-
const file = processTemplate(blueprintFile, {
|
|
90
|
-
entity,
|
|
91
|
-
options,
|
|
92
|
-
});
|
|
93
|
-
return [filePath, file];
|
|
94
|
-
}));
|
|
95
|
-
createFiles(fileMap, options);
|
|
96
|
-
}
|
|
97
|
-
function updateClass(entityName, { customizations, options }) {
|
|
80
|
+
export function updateClass(entityName, { customizations, options }) {
|
|
98
81
|
const { getFilePath } = customizations;
|
|
99
82
|
const { __styles__, projectRoot } = options;
|
|
100
83
|
const filePath = getFilePath(entityName);
|
|
101
|
-
const { ext
|
|
84
|
+
const { ext, name } = parseFilePath(filePath);
|
|
102
85
|
const data = {
|
|
103
86
|
__styles__,
|
|
104
|
-
fileName,
|
|
105
|
-
isTypeScript:
|
|
87
|
+
fileName: name,
|
|
88
|
+
isTypeScript: ext === '.ts',
|
|
106
89
|
};
|
|
107
90
|
try {
|
|
108
91
|
let file = readFileSync(join(projectRoot, filePath), 'utf8');
|
|
@@ -120,17 +103,3 @@ function updateClass(entityName, { customizations, options }) {
|
|
|
120
103
|
console.warn(`${message}\n`);
|
|
121
104
|
}
|
|
122
105
|
}
|
|
123
|
-
export function importStyles(entities, options) {
|
|
124
|
-
for (const [entityName, extensions] of entities) {
|
|
125
|
-
const hasClass = extensions.has('.js') || extensions.has('.ts');
|
|
126
|
-
const hasStylesheet = extensions.has('.css');
|
|
127
|
-
if (!hasStylesheet) {
|
|
128
|
-
continue;
|
|
129
|
-
}
|
|
130
|
-
if (!hasClass) {
|
|
131
|
-
createClass(entityName, options);
|
|
132
|
-
continue;
|
|
133
|
-
}
|
|
134
|
-
updateClass(entityName, options);
|
|
135
|
-
}
|
|
136
|
-
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { readFileSync } from 'node:fs';
|
|
2
2
|
import { extname, join } from 'node:path';
|
|
3
|
-
import {
|
|
3
|
+
import { AST } from '@codemod-utils/ast-javascript';
|
|
4
4
|
import { createFiles, findFiles } from '@codemod-utils/files';
|
|
5
5
|
function addCssEntryPoint(file, data) {
|
|
6
6
|
const traverse = AST.traverse(data.isTypeScript);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { join } from 'node:path';
|
|
2
|
-
import { updateTemplates } from './
|
|
2
|
+
import { updateTemplates } from './update-templates/index.js';
|
|
3
3
|
function getFilePath(options) {
|
|
4
4
|
const { componentStructure } = options;
|
|
5
5
|
return function (entityName) {
|
|
@@ -9,7 +9,16 @@ function updateDevDependencies(packageJson, options) {
|
|
|
9
9
|
packagesToDelete.forEach((packageName) => {
|
|
10
10
|
devDependencies.delete(packageName);
|
|
11
11
|
});
|
|
12
|
-
const packagesToInstall = new Set([
|
|
12
|
+
const packagesToInstall = new Set([
|
|
13
|
+
'@embroider/compat',
|
|
14
|
+
'@embroider/core',
|
|
15
|
+
'@embroider/webpack',
|
|
16
|
+
'autoprefixer',
|
|
17
|
+
'embroider-css-modules',
|
|
18
|
+
'postcss',
|
|
19
|
+
'postcss-loader',
|
|
20
|
+
'webpack',
|
|
21
|
+
]);
|
|
13
22
|
if (project.hasTypeScript) {
|
|
14
23
|
packagesToInstall.add('type-css-modules');
|
|
15
24
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { join } from 'node:path';
|
|
2
|
-
import { updateTemplates } from './
|
|
2
|
+
import { updateTemplates } from './update-templates/index.js';
|
|
3
3
|
function getFilePath() {
|
|
4
4
|
return function (entityName) {
|
|
5
5
|
let filePath = join('app/templates', entityName);
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { updateTemplate } from './update-template.js';
|
|
2
|
+
export function updateTemplates(entities, options) {
|
|
3
|
+
for (const [entityName, extensions] of entities) {
|
|
4
|
+
const hasTemplate = extensions.has('.hbs');
|
|
5
|
+
if (!hasTemplate) {
|
|
6
|
+
continue;
|
|
7
|
+
}
|
|
8
|
+
updateTemplate(entityName, options);
|
|
9
|
+
}
|
|
10
|
+
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/* eslint-disable @typescript-eslint/ban-ts-comment, @typescript-eslint/no-non-null-assertion */
|
|
2
2
|
import { readFileSync } from 'node:fs';
|
|
3
3
|
import { join } from 'node:path';
|
|
4
|
-
import {
|
|
4
|
+
import { AST } from '@codemod-utils/ast-template';
|
|
5
5
|
import { createFiles } from '@codemod-utils/files';
|
|
6
6
|
function sanitizeClassAndLocalClassAttributes(file) {
|
|
7
7
|
function removeAttributeWithoutValue(attributeName, attributes) {
|
|
@@ -327,7 +327,7 @@ function removeLocalClassAttributes(file, data) {
|
|
|
327
327
|
});
|
|
328
328
|
return AST.print(ast);
|
|
329
329
|
}
|
|
330
|
-
function updateTemplate(entityName, { customizations, options }) {
|
|
330
|
+
export function updateTemplate(entityName, { customizations, options }) {
|
|
331
331
|
const { getFilePath } = customizations;
|
|
332
332
|
const { __styles__, projectRoot } = options;
|
|
333
333
|
const filePath = getFilePath(entityName);
|
|
@@ -351,12 +351,3 @@ function updateTemplate(entityName, { customizations, options }) {
|
|
|
351
351
|
console.warn(`${message}\n`);
|
|
352
352
|
}
|
|
353
353
|
}
|
|
354
|
-
export function updateTemplates(entities, options) {
|
|
355
|
-
for (const [entityName, extensions] of entities) {
|
|
356
|
-
const hasTemplate = extensions.has('.hbs');
|
|
357
|
-
if (!hasTemplate) {
|
|
358
|
-
continue;
|
|
359
|
-
}
|
|
360
|
-
updateTemplate(entityName, options);
|
|
361
|
-
}
|
|
362
|
-
}
|
|
@@ -1,8 +1,14 @@
|
|
|
1
1
|
import { decideVersion } from '@codemod-utils/blueprints';
|
|
2
2
|
const latestVersions = new Map([
|
|
3
|
-
['embroider
|
|
4
|
-
['
|
|
5
|
-
['webpack', '
|
|
3
|
+
['@embroider/compat', '3.0.2'],
|
|
4
|
+
['@embroider/core', '3.0.2'],
|
|
5
|
+
['@embroider/webpack', '3.0.0'],
|
|
6
|
+
['autoprefixer', '10.4.14'],
|
|
7
|
+
['embroider-css-modules', '0.1.9'],
|
|
8
|
+
['postcss', '8.4.24'],
|
|
9
|
+
['postcss-loader', '7.3.3'],
|
|
10
|
+
['type-css-modules', '0.2.2'],
|
|
11
|
+
['webpack', '5.87.0'],
|
|
6
12
|
]);
|
|
7
13
|
export function getVersion(packageName, options) {
|
|
8
14
|
const { project } = options;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ember-codemod-remove-ember-css-modules",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.4.1",
|
|
4
4
|
"description": "Codemod to replace ember-css-modules with embroider-css-modules",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"codemod",
|
|
@@ -26,14 +26,16 @@
|
|
|
26
26
|
"dist"
|
|
27
27
|
],
|
|
28
28
|
"dependencies": {
|
|
29
|
-
"@codemod-utils/ast": "^0.
|
|
30
|
-
"@codemod-utils/
|
|
31
|
-
"@codemod-utils/
|
|
32
|
-
"@codemod-utils/
|
|
29
|
+
"@codemod-utils/ast-javascript": "^0.3.0",
|
|
30
|
+
"@codemod-utils/ast-template": "^0.3.0",
|
|
31
|
+
"@codemod-utils/blueprints": "^0.2.1",
|
|
32
|
+
"@codemod-utils/ember-cli-string": "^0.1.0",
|
|
33
|
+
"@codemod-utils/files": "^0.5.0",
|
|
34
|
+
"@codemod-utils/json": "^0.3.2",
|
|
33
35
|
"yargs": "^17.7.2"
|
|
34
36
|
},
|
|
35
37
|
"devDependencies": {
|
|
36
|
-
"@codemod-utils/tests": "^0.2.
|
|
38
|
+
"@codemod-utils/tests": "^0.2.3",
|
|
37
39
|
"@sondr3/minitest": "^0.1.1",
|
|
38
40
|
"@types/node": "^16.11.7",
|
|
39
41
|
"@types/yargs": "^17.0.24",
|
|
@@ -41,8 +43,8 @@
|
|
|
41
43
|
"eslint": "^8.43.0",
|
|
42
44
|
"prettier": "^2.8.8",
|
|
43
45
|
"typescript": "^5.1.3",
|
|
44
|
-
"@shared-configs/prettier": "0.0.0",
|
|
45
46
|
"@shared-configs/eslint-config-node": "0.0.0",
|
|
47
|
+
"@shared-configs/prettier": "0.0.0",
|
|
46
48
|
"@shared-configs/typescript": "0.0.0"
|
|
47
49
|
},
|
|
48
50
|
"engines": {
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
/* https://github.com/ember-cli/ember-cli-string-utils/blob/v1.1.0/index.js */
|
|
2
|
-
const STRING_CAMELIZE_REGEXP = /(-|_|\.|\s)+(.)?/g;
|
|
3
|
-
export function camelize(value) {
|
|
4
|
-
return value
|
|
5
|
-
.replace(STRING_CAMELIZE_REGEXP, function (_match, _separator, character) {
|
|
6
|
-
return character ? character.toUpperCase() : '';
|
|
7
|
-
})
|
|
8
|
-
.replace(/^([A-Z])/, function (match) {
|
|
9
|
-
return match.toLowerCase();
|
|
10
|
-
});
|
|
11
|
-
}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
/* https://github.com/ember-cli/ember-cli-string-utils/blob/v1.1.0/index.js */
|
|
2
|
-
import { camelize } from './camelize.js';
|
|
3
|
-
export function classify(value) {
|
|
4
|
-
const tokens = value.split('.');
|
|
5
|
-
const tokensTransformed = tokens.map((token) => {
|
|
6
|
-
const camelized = camelize(token);
|
|
7
|
-
return camelized.charAt(0).toUpperCase() + camelized.substring(1);
|
|
8
|
-
});
|
|
9
|
-
return tokensTransformed.join('.');
|
|
10
|
-
}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
/* https://github.com/emberjs/ember.js/blob/v4.12.0/blueprints/component-test/index.js#L13-L16 */
|
|
2
|
-
import { classify } from '../ember-cli-string-utils/classify.js';
|
|
3
|
-
export function doubleColonizeEntityName(entityName) {
|
|
4
|
-
const tokens = entityName.split('/');
|
|
5
|
-
const tokensTransformed = tokens.map(classify);
|
|
6
|
-
return tokensTransformed.join('::');
|
|
7
|
-
}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { parse } from 'node:path';
|
|
2
|
-
import { classifyEntityName } from './classify.js';
|
|
3
|
-
import { doubleColonizeEntityName } from './double-colonize.js';
|
|
4
|
-
export function parseEntityName(entityName) {
|
|
5
|
-
const classifiedName = classifyEntityName(entityName);
|
|
6
|
-
const doubleColonizedName = doubleColonizeEntityName(entityName);
|
|
7
|
-
const { name: fileName } = parse(entityName);
|
|
8
|
-
const entity = {
|
|
9
|
-
classifiedName,
|
|
10
|
-
doubleColonizedName,
|
|
11
|
-
fileName,
|
|
12
|
-
name: entityName,
|
|
13
|
-
};
|
|
14
|
-
return entity;
|
|
15
|
-
}
|
package/dist/src/utils/string.js
DELETED
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
export * from './string/ember-cli-string-utils/camelize.js';
|
|
2
|
-
export * from './string/ember-cli-string-utils/classify.js';
|
|
3
|
-
export * from './string/entity-name/classify.js';
|
|
4
|
-
export * from './string/entity-name/double-colonize.js';
|
|
5
|
-
export * from './string/entity-name/parse.js';
|