Skip to content

Commit

Permalink
Downstreamed changes from @[email protected] (#151)
Browse files Browse the repository at this point in the history
* chore: Updated dependencies

* chore: Updated import statements

* refactor: Renamed variables

* chore: Simplified scripts

* chore: Added changeset

---------

Co-authored-by: ijlee2 <[email protected]>
  • Loading branch information
ijlee2 and ijlee2 authored Aug 28, 2024
1 parent 625888d commit 4963de9
Show file tree
Hide file tree
Showing 18 changed files with 177 additions and 319 deletions.
6 changes: 6 additions & 0 deletions .changeset/great-planes-arrive.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
"ember-codemod-remove-ember-css-modules": patch
"type-css-modules": patch
---

Downstreamed changes from @codemod-utils@2.0.1
6 changes: 3 additions & 3 deletions packages/ember-codemod-remove-ember-css-modules/.npmignore
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
/.prettierignore
/.prettierrc.cjs
/build.sh
/codemod-test-fixture.sh
/codemod-test-fixtures.sh
/create-test-fixture.sh
/CHANGELOG.md
/CONTRIBUTING.md
/update-test-fixtures.sh
/tests/

This file was deleted.

This file was deleted.

107 changes: 0 additions & 107 deletions packages/ember-codemod-remove-ember-css-modules/create-test-fixture.sh

This file was deleted.

4 changes: 2 additions & 2 deletions packages/ember-codemod-remove-ember-css-modules/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
"@codemod-utils/ast-javascript": "^1.2.8",
"@codemod-utils/ast-template": "^1.1.4",
"@codemod-utils/blueprints": "^1.1.5",
"@codemod-utils/ember-cli-string": "^1.1.4",
"@codemod-utils/ember": "^2.0.0",
"@codemod-utils/files": "^2.0.4",
"@codemod-utils/json": "^1.1.9",
"yargs": "^17.7.2"
Expand All @@ -50,7 +50,7 @@
"@shared-configs/prettier": "workspace:*",
"@shared-configs/typescript": "workspace:*",
"@sondr3/minitest": "^0.1.2",
"@types/node": "^18.19.44",
"@types/node": "^18.19.47",
"@types/yargs": "^17.0.33",
"concurrently": "^8.2.2",
"eslint": "^8.57.0",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@ import Component from '@glimmer/component';

<% if (options.componentStructure === 'nested') { %>import styles from './index.css';<% } else { %>import styles from './<%= entity.fileName %>.css';<% } %>

export default class <%= entity.classifiedName %>Component extends Component {
export default class <%= entity.pascalizedName %>Component extends Component {
styles = styles;
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import Component from '@glimmer/component';

<% if (options.componentStructure === 'nested') { %>import styles from './index.css';<% } else { %>import styles from './<%= entity.fileName %>.css';<% } %>

interface <%= entity.classifiedName %>Signature {
interface <%= entity.pascalizedName %>Signature {
// The arguments accepted by the component
Args: {};
// Any blocks yielded by the component
Expand All @@ -13,14 +13,14 @@ interface <%= entity.classifiedName %>Signature {
Element: null;
}

export default class <%= entity.classifiedName %>Component extends Component<<%= entity.classifiedName %>Signature> {
export default class <%= entity.pascalizedName %>Component extends Component<<%= entity.pascalizedName %>Signature> {
styles = styles;
}
<% if (options.project.hasGlint) { %>
declare module '@glint/environment-ember-loose/registry' {
export default interface Registry {
'<%= entity.doubleColonizedName %>': typeof <%= entity.classifiedName %>Component;
'<%= entity.name %>': typeof <%= entity.classifiedName %>Component;
'<%= entity.doubleColonizedName %>': typeof <%= entity.pascalizedName %>Component;
'<%= entity.name %>': typeof <%= entity.pascalizedName %>Component;
}
}
<% } %>
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@ import Controller from '@ember/controller';

import styles from './<%= entity.fileName %>.css';

export default class <%= entity.classifiedName %>Controller extends Controller {
export default class <%= entity.pascalizedName %>Controller extends Controller {
styles = styles;
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@ import Controller from '@ember/controller';

import styles from './<%= entity.fileName %>.css';

export default class <%= entity.classifiedName %>Controller extends Controller {
export default class <%= entity.pascalizedName %>Controller extends Controller {
styles = styles;
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { readFileSync } from 'node:fs';
import { join } from 'node:path';

import { processTemplate } from '@codemod-utils/blueprints';
import { classify, doubleColonize } from '@codemod-utils/ember-cli-string';
import { doubleColonize, pascalize } from '@codemod-utils/ember';
import { createFiles, parseFilePath } from '@codemod-utils/files';

import type { OptionsForImportStyles } from '../../../types/index.js';
Expand All @@ -15,10 +15,10 @@ export function createClass(
const { blueprintFilePaths, getFilePath } = customizations;

const entity = {
classifiedName: classify(entityName),
doubleColonizedName: doubleColonize(entityName),
fileName: parseFilePath(entityName).name,
name: entityName,
pascalizedName: pascalize(entityName),
};

const filePath = getFilePath(entityName);
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
#!/usr/bin/env sh

#----------
#
# A. Purpose
#
# Fix all test fixtures after updating the source code.
#
# B. Usage
#
# ./update-test-fixtures.sh
#
#---------

# Compile TypeScript
pnpm build

# Update fixtures
rm -r "tests/fixtures/ember-app/ember-container-query-glint/output"
cp -r "tests/fixtures/ember-app/ember-container-query-glint/input" "tests/fixtures/ember-app/ember-container-query-glint/output"

./dist/bin/ember-codemod-remove-ember-css-modules.js \
--root "tests/fixtures/ember-app/ember-container-query-glint/output" \
--type app

# Update fixtures
rm -r "tests/fixtures/ember-app/ember-container-query-javascript/output"
cp -r "tests/fixtures/ember-app/ember-container-query-javascript/input" "tests/fixtures/ember-app/ember-container-query-javascript/output"

./dist/bin/ember-codemod-remove-ember-css-modules.js \
--root "tests/fixtures/ember-app/ember-container-query-javascript/output" \
--type app

# Update fixtures
rm -r "tests/fixtures/ember-app/ember-container-query-nested/output"
cp -r "tests/fixtures/ember-app/ember-container-query-nested/input" "tests/fixtures/ember-app/ember-container-query-nested/output"

./dist/bin/ember-codemod-remove-ember-css-modules.js \
--component-structure nested \
--root "tests/fixtures/ember-app/ember-container-query-nested/output" \
--type app

# Update fixtures
rm -r "tests/fixtures/ember-app/ember-container-query-typescript/output"
cp -r "tests/fixtures/ember-app/ember-container-query-typescript/input" "tests/fixtures/ember-app/ember-container-query-typescript/output"

./dist/bin/ember-codemod-remove-ember-css-modules.js \
--root "tests/fixtures/ember-app/ember-container-query-typescript/output" \
--type app

# Update fixtures
rm -r "tests/fixtures/ember-v2-addon/my-v2-addon-glint/output"
cp -r "tests/fixtures/ember-v2-addon/my-v2-addon-glint/input" "tests/fixtures/ember-v2-addon/my-v2-addon-glint/output"

./dist/bin/ember-codemod-remove-ember-css-modules.js \
--root "tests/fixtures/ember-v2-addon/my-v2-addon-glint/output" \
--type v2-addon

# Update fixtures
rm -r "tests/fixtures/ember-v2-addon/my-v2-addon-javascript/output"
cp -r "tests/fixtures/ember-v2-addon/my-v2-addon-javascript/input" "tests/fixtures/ember-v2-addon/my-v2-addon-javascript/output"

./dist/bin/ember-codemod-remove-ember-css-modules.js \
--root "tests/fixtures/ember-v2-addon/my-v2-addon-javascript/output" \
--type v2-addon

# Update fixtures
rm -r "tests/fixtures/ember-v2-addon/my-v2-addon-nested/output"
cp -r "tests/fixtures/ember-v2-addon/my-v2-addon-nested/input" "tests/fixtures/ember-v2-addon/my-v2-addon-nested/output"

./dist/bin/ember-codemod-remove-ember-css-modules.js \
--component-structure nested \
--root "tests/fixtures/ember-v2-addon/my-v2-addon-nested/output" \
--type v2-addon

# Update fixtures
rm -r "tests/fixtures/ember-v2-addon/my-v2-addon-typescript/output"
cp -r "tests/fixtures/ember-v2-addon/my-v2-addon-typescript/input" "tests/fixtures/ember-v2-addon/my-v2-addon-typescript/output"

./dist/bin/ember-codemod-remove-ember-css-modules.js \
--root "tests/fixtures/ember-v2-addon/my-v2-addon-typescript/output" \
--type v2-addon
Loading

0 comments on commit 4963de9

Please sign in to comment.