Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move core modules to @textlint namespace #455

Closed
8 tasks done
azu opened this issue Jan 11, 2018 · 13 comments · Fixed by #486
Closed
8 tasks done

Move core modules to @textlint namespace #455

azu opened this issue Jan 11, 2018 · 13 comments · Fixed by #486
Labels
good first issue Good for newcomers Type: Breaking Change Includes breaking changes

Comments

@azu
Copy link
Member

azu commented Jan 11, 2018

ℹ️ Migration information

For textlint user

If you have seen following deprecated warning, please update lateste textlint, textlint-tester, or textlint-scripts.

warning textlint-scripts > textlint-tester > textlint > textlint-plugin-text@1.1.4: See https://github.com/textlint/textlint/issues/455
warning textlint-scripts > textlint-tester > textlint > txt-ast-traverse@1.2.1: See https://github.com/textlint/textlint/issues/455
warning textlint-scripts > textlint-tester > textlint > textlint-formatter@1.8.0: See https://github.com/textlint/textlint/issues/455
warning textlint-scripts > textlint-tester > textlint > textlint-plugin-markdown@2.0.5: See https://github.com/textlint/textlint/issues/455
warning textlint-scripts > textlint-tester > textlint > textlint-plugin-text > txt-to-ast@1.1.0: See https://github.com/textlint/textlint/issues/455
warning textlint-scripts > textlint-tester > textlint > textlint-plugin-markdown > markdown-to-ast@4.0.0: See https://github.com/textlint/textlint/issues/455
warning textlint-scripts > textlint-tester > textlint > @textlint/kernel > txt-ast-traverse@1.2.1: See https://github.com/textlint/textlint/issues/455

Update latest version

npm install textlint@latest
npm install textlint-scripts@latest

For node modules user

If you use someone of Migration pacakges, please move to scoped version.

For example, If you use markdown-to-ast, you migrate from markdown-to-ast to @textlint/markdown-to-ast.

npm uninstall markdown-to-ast
npm install @textlint/markdown-to-ast

And, you should change require("markdown-to-ast") to require("@textlint/markdown-to-ast").


npm recommened to use scoped.

If you are prevented from publishing a package with a name too similar to an existing package, the easiest way to find a unique name is to use your scope. You can scope packages to your npm account by putting @ + your npm user name in front of the name. For example, my npm user name is ceejbot, so my scope is @ceejbot.
http://blog.npmjs.org/post/168978377570/new-package-moniker-rules

We already have @textlint scope.

Pros

  • Make explicit

For example, markdown-to-ast is confused name.

Cons

  • Name chaning!

But, almost pacakges are only used in textlint.

Migration pacakges

PR Before After
#473 txt-to-ast @textlint/text-to-ast
#460 markdown-to-ast @textlint/markdown-to-ast
#483 textlint-ast-test @textlint/ast-tester
#484 txt-ast-traverse @textlint/ast-traverse
#482 textlint-fixer-formatter @textlint/fixer-formatter
#474 textlint-formatter @textlint/linter-formatter
#485 textlint-plugin-markdown @textlint/textlint-plugin-markdown
#486 textlint-plugin-text @textlint/textlint-plugin-text
Migration Packages List

No migration packages

These packages are used by external user.

  • textlint
    • textlint it-self!
  • gulp-textlint
    • textlint user use it
  • textlint-tester
    • textlint rule creator use it

How to migrate?

Migrate to @textlint.
Maybe, transfer-github-owner help this.

Example: #473 #460

  1. Move <name> to @textlint/<name> directory 710a09e
  2. change usage of <name> to @textlint/<name> 5a12178
  • And update yarn.lock by yarn bootstrap
  1. Update core package table ec78494
  • 💔 textlint-rule-no-dead-link found it as dead link
  1. Add "publishConfig" 929b575
  • "publishConfig": { "access": "public" } config is needed when you publish Scoped packages at first time
  • Alt. npm publish --access public is anthor option
  • But, publishConfig is more reasonable.
  1. npm publish it as @textlint/<name> from local
  1. Create PR

Finally, deprecate old pacakge:

npm deprecate <old-pacakge> "See https://github.com/textlint/textlint/issues/455"
@azu azu added Status: Proposal Request for comments good first issue Good for newcomers labels Jan 11, 2018
@0x6b
Copy link
Member

0x6b commented Jan 11, 2018

@azu, I have a question; do we migrate textlint-* to @textlint/textlint-*, or to @textlint/*? e.g. @textlint/textlint-formatter or @textlint/formatter?

Since textlint- prefix is for name space, use it under scoped environment looks redundant for me.

@azu
Copy link
Member Author

azu commented Jan 11, 2018

@0x6b Good question!

I've updated migration name.

@0x6b
Copy link
Member

0x6b commented Jan 11, 2018

@azu, thank you for the clarification. It's good move.

txt-to-ast -> @textlint/txt-to-ast or @textlint/text-to-ast

+1 for @textlint/text-to-ast. Mixing "text" with "txt" in a package name is confusing and error–prone?

@azu
Copy link
Member Author

azu commented Jan 12, 2018

I decided that rename txt-to-ast to @textlint/text-to-ast

@0x6b
Copy link
Member

0x6b commented Jan 12, 2018

@azu, thank you.

I'm on my way to migrate textlint-formatter, and found that until you publish it as new name to the npm registry:

So, while migrating, I think I need two pull requests. Am I missing anything?

  1. Move a module to @textlint directory, update dependents, pass the tests
  2. Open a pull request and ask you publish the module as new name
  3. After publish, update dependents, yarn.lock, and related documents, pass the tests
  4. Open another pull request and ask you deprecate old package

@azu
Copy link
Member Author

azu commented Jan 13, 2018

no-dead-link rule fails because migrated package has new URL e.g. https://www.npmjs.com/package/@textlint/formatter

Yes! I've tried that move markdown-to-ast to @textlint/linter-formatter #460
#460's step 5(npm publish from local) is needed to pass CI.
In other words, step 5 create placeholder(temporary) page https://www.npmjs.com/package/@textlint/markdown-to-ast

It is better that complete migration task in a single PR :)

I've added @0x6b to npm @textlint member.
So, You can publish new package to @textlint scope.
In other words, you can do step5.

FYI: textlint-formatter will be @textlint/linter-formatter.

@azu
Copy link
Member Author

azu commented Jan 13, 2018

@Leko I want to invite you to npm @textlint member.
Your npm account is lekoleko?

@0x6b
Copy link
Member

0x6b commented Jan 13, 2018

@azu, thank you for adding me to the npm organization!
As for new name for textlint-formatter, I have to rework on local branch...anyway thank you for pointing out.

@0x6b
Copy link
Member

0x6b commented Jan 19, 2018

@azu, while refactoring textlint-plugin-markdown to @textlint/textlint-plugin-markdown, textlint-engine-test was failed with following error:

const engine = new TextLintEngine({ plugins: ["markdown"] });

  1) textlint-engine-test
       #loadPlugin
         when Plugin has not rules
           should not throw Error:
     ReferenceError: Failed to load textlint's plugin module: "markdown" is not found.

@azu
Copy link
Member Author

azu commented Jan 19, 2018

@0x6b

const engine = new TextLintEngine({ plugins: ["markdown"] });

Probably, you need to change plugin name.
This plugin name is shortcut of pacakge name(@textlint/textlint-plugin-markdown)

  • markdown -> textlint-plugin-markdown
  • @textlint/markdown -> textlint/textlint-plugin-markdown
- const engine = new TextLintEngine({ plugins: ["markdown"] });
+ const engine = new TextLintEngine({ plugins: ["@textlint/markdown"] });

@0x6b
Copy link
Member

0x6b commented Jan 19, 2018

@azu, you are right! (as always)
textlint-module-resolver already take account this path. Impressed. Thank you.

// if @scope/<name> -> @scope/<prefix><name>

@0x6b
Copy link
Member

0x6b commented Jan 19, 2018

$ for package in txt-to-ast markdown-to-ast textlint-ast-test txt-ast-traverse textlint-fixer-formatter textlint-formatter textlint-plugin-markdown textlint-plugin-text; do echo -n "$package: "; npm info --json $package | jq .deprecated; done
txt-to-ast: "See https://github.com/textlint/textlint/issues/455"
markdown-to-ast: "See https://github.com/textlint/textlint/issues/455"
textlint-ast-test: "See https://github.com/textlint/textlint/issues/455"
txt-ast-traverse: "See https://github.com/textlint/textlint/issues/455"
textlint-fixer-formatter: "See https://github.com/textlint/textlint/issues/455"
textlint-formatter: "See https://github.com/textlint/textlint/issues/455"
textlint-plugin-markdown: "See https://github.com/textlint/textlint/issues/455"
textlint-plugin-text: "See https://github.com/textlint/textlint/issues/455"

Now we can go to another set of refactoring such as TypeScript-ify or Jest-ing (#451).

@0x6b 0x6b removed the Status: In Progress Work in Progress label Jan 20, 2018
@0x6b
Copy link
Member

0x6b commented Jan 20, 2018

Found that npm view <package> deprecated is simpler than npm info --json <package> | jq .deprecated.

$ for package in txt-to-ast markdown-to-ast textlint-ast-test txt-ast-traverse textlint-fixer-formatter textlint-formatter textlint-plugin-markdown textlint-plugin-text; do echo -n "$package: "; npm view $package deprecated; done
txt-to-ast: See https://github.com/textlint/textlint/issues/455
markdown-to-ast: See https://github.com/textlint/textlint/issues/455
textlint-ast-test: See https://github.com/textlint/textlint/issues/455
txt-ast-traverse: See https://github.com/textlint/textlint/issues/455
textlint-fixer-formatter: See https://github.com/textlint/textlint/issues/455
textlint-formatter: See https://github.com/textlint/textlint/issues/455
textlint-plugin-markdown: See https://github.com/textlint/textlint/issues/455
textlint-plugin-text: See https://github.com/textlint/textlint/issues/455

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers Type: Breaking Change Includes breaking changes
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants