Skip to content
This repository has been archived by the owner on Jul 9, 2018. It is now read-only.

Url Module: Bootstrap the repository and add the first module #1

Merged
merged 3 commits into from
Jun 28, 2017

Conversation

youknowriad
Copy link
Collaborator

This PR tries to bootstrap the repository using a simple Lerna config.
This PR is highly inspired by how the Jest Repository works.
The idea is trying to build our workflow around a simple module breaking things up into several PRs.
For this initial PR, I'm setting up the build script. (Trying to keep it as small as possible)
Follow-up PRs should think about linting, testing, watching...

Included in this PR:

  • The url module as as an example module. The example function here is actually extracted from The Gutenberg repository.
  • A build script allowing us to build all the modules with the same script (avoid duplicating the logic in all submodules)
  • The babel config is the one used for Gutenberg

Not included yet:

  • The browser build should automatically generate the wp.url global variable.

Testing instructions

npm install --global lerna@^2.0.0-beta.0
npm install
lerna bootstrap
npm run build

@youknowriad youknowriad self-assigned this Jun 27, 2017
rmccue
rmccue previously requested changes Jun 28, 2017
Copy link
Collaborator

@rmccue rmccue left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Few indentation issues here.

lerna.json Outdated
"packages/*"
],
"version": "0.0.0"
}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we use tabs in JSON config too? 🤔

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, I'll add an .editorconfig shortly, WordPress is switching back to tabs for .json files:

See #WP40946 and WordPress/gutenberg#1067

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is auto-generated by lerna, I wonder if it forces spacing indentation if I replace with tabs. I'll test.

"description": "WordPress URL utilities",
"main": "build/index.js",
"module": "build-module/index.js",
"browser": "build-browser/index.js",
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mixed indentation.

scripts/build.js Outdated
* Babel Configuration
*/
const babelDefaultConfig = JSON.parse(
fs.readFileSync( path.resolve( __dirname, '..', '.babelrc' ), 'utf8' )
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mixed indentation.

scripts/watch.js Outdated
return fs.statSync(filename).isFile();
} catch (e) {}
return false;
};
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should probably tabify this file too.

@youknowriad
Copy link
Collaborator Author

I'll fix those indentation issues, hopefully we could get eslint soon :)

@youknowriad youknowriad dismissed rmccue’s stale review June 28, 2017 09:59

Thanks for the review, The indentation issues should be fixed. I am using tabs for everything except the package.json

@ntwb
Copy link
Member

ntwb commented Jun 28, 2017

@youknowriad I'll have an ESLint PR soon 😄

@youknowriad
Copy link
Collaborator Author

I'd appreciate some 👀 and a ✅ to move forward with the other steps (testing, watching...)

.babelrc Outdated
"last 2 iOS versions",
"last 1 Android version",
"last 1 ChromeAndroid version",
"ie 11"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did you omit the last 2 edge versions on purpose?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've just copy/pasted from Gutenberg, we missed Edge :)

package.json Outdated
"mkdirp": "^0.5.1"
},
"scripts": {
"build-clean": "rm -rf ./packages/*/build ./packages/*/build-es5",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This won't work on windows. Is that a concern? If so, we could use rimraf.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch, let's not leave Windows users behind :)

@atimmer
Copy link
Member

atimmer commented Jun 28, 2017

I have commented in two locations. I have also tested this locally, for me this PR is ✅. Concerns could be addressed in new PRs.

@youknowriad
Copy link
Collaborator Author

Thanks for the review, Feedback addressed.

@youknowriad youknowriad merged commit 736c86e into master Jun 28, 2017
@youknowriad youknowriad deleted the add/url-module branch June 28, 2017 21:45
@gziolo
Copy link
Member

gziolo commented Jul 2, 2017

Cool, lerna seems like the best way to go here 👍

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants