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

Print out directory tree during docusaurus-init #665

Merged
merged 5 commits into from
May 16, 2018

Conversation

amyrlam
Copy link
Contributor

@amyrlam amyrlam commented May 15, 2018

cc @yangshun This might be way off...wondering if there is anything wrong at first glance.

I rm -rf website/ in Docusaurus.

I tried replacing an existing console.log with new text.

When I run docusaurus-init, the old text appears, even though it's been deleted from the codebase. Is the repo reading docusaurus-init from npm or something and not from local copy-examples.js?

Run docusaurus-init

Even by deleting text here, it still shows up? Confused.
@facebook-github-bot facebook-github-bot added the CLA Signed Signed Facebook CLA label May 15, 2018
@docusaurus-bot
Copy link
Contributor

docusaurus-bot commented May 15, 2018

Deploy preview for docusaurus-preview ready!

Built with commit 4fb727f

https://deploy-preview-665--docusaurus-preview.netlify.com

@yangshun yangshun self-assigned this May 15, 2018
@yangshun yangshun self-requested a review May 15, 2018 19:58
@yangshun yangshun changed the title [WIP] Add tree node cli Print out directory tree during docusaurus-init May 16, 2018
@yangshun
Copy link
Contributor

@amyrlam I patched it locally and tested it. This should be good to go!

Copy link
Contributor

@yangshun yangshun left a comment

Choose a reason for hiding this comment

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

Tested it locally. Seems fine!

@yangshun yangshun merged commit 1796764 into facebook:master May 16, 2018
@amyrlam
Copy link
Contributor Author

amyrlam commented May 16, 2018

Sorry, I'm confused.

Trying to reproduce locally. What am I doing wrong? Not seeing the tree but Example website created in Docusaurus/website.

alam@tesla Docusaurus (master) $ git log -1
commit 1796764b1cc56f9c2e46e937a7aa2ffd417b267c (HEAD -> master, upstream/master, amy/tree-check)
Author: Amy Lam <alam@fastly.com>
Date:   Tue May 15 20:06:44 2018 -0700

    Print out directory tree during docusaurus-init (#665)

    * WIP does not work

    * rm -rf website/

    Run docusaurus-init

    Even by deleting text here, it still shows up? Confused.

    * Shift in tree printing logic

    * Shift printing logic to the current location
alam@tesla Docusaurus (master) $ rm -rf website/
alam@tesla Docusaurus (master) $ rm -rf docs-examples-from-docusaurus/
alam@tesla Docusaurus (master) $ rm -rf docs
alam@tesla Docusaurus (master) $ docusaurus-init
Website folder created!

Installing latest version of Docusaurus in website.

yarn add v1.6.0
warning package.json: No license field
info No lockfile found.
warning No license field
[1/4] Resolving packages...
warning docusaurus > markdown-toc > gray-matter > coffee-script@1.12.7: CoffeeScript on NPM has moved to "coffeescript" (no hyphen)
[2/4] Fetching packages...
[3/4] Linking dependencies...
[4/4] Building fresh packages...
success Saved lockfile.
success Saved 317 new dependencies.
info Direct dependencies
└─ docusaurus@1.0.15
info All dependencies
├─ accepts@1.3.5
├─ ajv@5.5.2
├─ ansi-red@0.1.1
├─ ansi-styles@2.2.1
├─ ansi-wrap@0.1.0
├─ array-flatten@1.1.1
├─ asap@2.0.6
├─ asn1@0.2.3
├─ asynckit@0.4.0
├─ autolinker@0.15.3
├─ autoprefixer@6.7.7
├─ aws-sign2@0.7.0
├─ aws4@1.7.0
├─ babel-core@6.26.3
├─ babel-generator@6.26.1
├─ babel-helper-builder-binary-assignment-operator-visitor@6.24.1
├─ babel-helper-builder-react-jsx@6.26.0
├─ babel-helper-call-delegate@6.24.1
├─ babel-helper-define-map@6.26.0
├─ babel-helper-explode-assignable-expression@6.24.1
├─ babel-helper-remap-async-to-generator@6.24.1
├─ babel-helpers@6.24.1
├─ babel-plugin-check-es2015-constants@6.22.0
├─ babel-plugin-syntax-async-functions@6.13.0
├─ babel-plugin-syntax-class-properties@6.13.0
├─ babel-plugin-syntax-exponentiation-operator@6.13.0
├─ babel-plugin-syntax-flow@6.18.0
├─ babel-plugin-syntax-object-rest-spread@6.13.0
├─ babel-plugin-syntax-trailing-function-commas@6.22.0
├─ babel-plugin-transform-async-to-generator@6.24.1
├─ babel-plugin-transform-class-properties@6.24.1
├─ babel-plugin-transform-es2015-arrow-functions@6.22.0
├─ babel-plugin-transform-es2015-block-scoped-functions@6.22.0
├─ babel-plugin-transform-es2015-block-scoping@6.26.0
├─ babel-plugin-transform-es2015-classes@6.24.1
├─ babel-plugin-transform-es2015-computed-properties@6.24.1
├─ babel-plugin-transform-es2015-destructuring@6.23.0
├─ babel-plugin-transform-es2015-duplicate-keys@6.24.1
├─ babel-plugin-transform-es2015-for-of@6.23.0
├─ babel-plugin-transform-es2015-function-name@6.24.1
├─ babel-plugin-transform-es2015-literals@6.22.0
├─ babel-plugin-transform-es2015-modules-amd@6.24.1
├─ babel-plugin-transform-es2015-modules-commonjs@6.26.2
├─ babel-plugin-transform-es2015-modules-systemjs@6.24.1
├─ babel-plugin-transform-es2015-modules-umd@6.24.1
├─ babel-plugin-transform-es2015-object-super@6.24.1
├─ babel-plugin-transform-es2015-parameters@6.24.1
├─ babel-plugin-transform-es2015-shorthand-properties@6.24.1
├─ babel-plugin-transform-es2015-spread@6.22.0
├─ babel-plugin-transform-es2015-sticky-regex@6.24.1
├─ babel-plugin-transform-es2015-template-literals@6.22.0
├─ babel-plugin-transform-es2015-typeof-symbol@6.23.0
├─ babel-plugin-transform-es2015-unicode-regex@6.24.1
├─ babel-plugin-transform-exponentiation-operator@6.24.1
├─ babel-plugin-transform-flow-strip-types@6.22.0
├─ babel-plugin-transform-object-rest-spread@6.26.0
├─ babel-plugin-transform-react-display-name@6.25.0
├─ babel-plugin-transform-react-jsx-self@6.22.0
├─ babel-plugin-transform-react-jsx-source@6.22.0
├─ babel-plugin-transform-react-jsx@6.24.1
├─ babel-plugin-transform-regenerator@6.26.0
├─ babel-plugin-transform-strict-mode@6.24.1
├─ babel-polyfill@6.26.0
├─ babel-preset-env@1.7.0
├─ babel-preset-flow@6.23.0
├─ babel-preset-react@6.24.1
├─ babel-register@6.26.0
├─ bcrypt-pbkdf@1.0.1
├─ body-parser@1.18.2
├─ boom@4.3.1
├─ brace-expansion@1.1.11
├─ browserslist@1.7.7
├─ buffer-from@1.0.0
├─ caniuse-api@1.6.1
├─ caniuse-db@1.0.30000841
├─ caniuse-lite@1.0.30000841
├─ caseless@0.12.0
├─ clap@1.2.3
├─ classnames@2.2.5
├─ clone@1.0.4
├─ co@4.6.0
├─ coa@1.0.4
├─ coffee-script@1.12.7
├─ color-convert@1.9.1
├─ color-string@1.5.2
├─ color@2.0.1
├─ colormin@1.1.2
├─ colors@1.1.2
├─ combined-stream@1.0.6
├─ commander@2.15.1
├─ concat-map@0.0.1
├─ concat-stream@1.6.2
├─ content-disposition@0.5.2
├─ convert-source-map@1.5.1
├─ cookie-signature@1.0.6
├─ cookie@0.3.1
├─ core-js@2.5.6
├─ core-util-is@1.0.2
├─ create-react-class@15.6.3
├─ crowdin-cli@0.3.0
├─ cryptiles@3.1.2
├─ css-color-names@0.0.4
├─ cssnano@3.10.0
├─ csso@2.3.2
├─ dashdash@1.14.1
├─ decamelize@1.2.0
├─ deep-is@0.1.2
├─ defined@1.0.0
├─ delayed-stream@1.0.0
├─ destroy@1.0.4
├─ detect-indent@4.0.0
├─ diacritics-map@0.1.0
├─ docusaurus@1.0.15
├─ ecc-jsbn@0.1.1
├─ ee-first@1.1.1
├─ electron-to-chromium@1.3.46
├─ encoding@0.1.12
├─ escape-string-regexp@1.0.5
├─ esprima@4.0.0
├─ expand-range@1.8.2
├─ express@4.16.3
├─ extend@3.0.1
├─ extsprintf@1.3.0
├─ fast-deep-equal@1.1.0
├─ fast-json-stable-stringify@2.0.0
├─ feed@1.1.1
├─ fill-range@2.2.4
├─ finalhandler@1.1.1
├─ flatten@1.0.2
├─ for-in@1.0.2
├─ forever-agent@0.6.1
├─ form-data@2.3.2
├─ forwarded@0.1.2
├─ fs-extra@5.0.0
├─ fs.realpath@1.0.0
├─ function-bind@1.1.1
├─ getpass@0.1.7
├─ glob@7.1.2
├─ globals@9.18.0
├─ graceful-fs@4.1.11
├─ gray-matter@2.1.1
├─ har-schema@2.0.0
├─ har-validator@5.0.3
├─ has-ansi@2.0.0
├─ has-flag@3.0.0
├─ hawk@6.0.2
├─ highlight.js@9.12.0
├─ home-or-tmp@2.0.0
├─ html-comment-regex@1.1.1
├─ http-signature@1.2.0
├─ indexes-of@1.0.1
├─ inflight@1.0.6
├─ interpret@1.1.0
├─ ipaddr.js@1.6.0
├─ is-absolute-url@2.1.0
├─ is-arrayish@0.3.1
├─ is-buffer@1.1.6
├─ is-extendable@1.0.1
├─ is-finite@1.0.2
├─ is-plain-obj@1.1.0
├─ is-plain-object@2.0.4
├─ is-stream@1.1.0
├─ is-svg@2.1.0
├─ is-typedarray@1.0.0
├─ is2@0.0.9
├─ isarray@1.0.0
├─ isomorphic-fetch@2.2.1
├─ isstream@0.1.2
├─ js-base64@2.4.3
├─ js-tokens@3.0.2
├─ js-yaml@3.11.0
├─ jsesc@1.3.0
├─ json-schema-traverse@0.3.1
├─ json-schema@0.2.3
├─ json-stringify-safe@5.0.1
├─ json5@0.5.1
├─ jsonfile@4.0.0
├─ jsprim@1.4.1
├─ lazy-cache@2.0.2
├─ list-item@1.1.1
├─ lodash.memoize@4.1.2
├─ lodash.uniq@4.5.0
├─ macaddress@0.2.8
├─ markdown-link@0.1.1
├─ markdown-toc@1.2.0
├─ math-expression-evaluator@1.2.17
├─ math-random@1.0.1
├─ media-typer@0.3.0
├─ merge-descriptors@1.0.1
├─ methods@1.1.2
├─ mime-db@1.33.0
├─ mime-types@2.1.18
├─ mime@1.4.1
├─ minimist@0.0.8
├─ mixin-deep@1.3.1
├─ mkdirp@0.5.1
├─ negotiator@0.6.1
├─ node-fetch@1.7.3
├─ normalize-range@0.1.2
├─ normalize-url@1.9.1
├─ num2fraction@1.2.2
├─ number-is-nan@1.0.1
├─ oauth-sign@0.8.2
├─ object.pick@1.3.0
├─ os-homedir@1.0.2
├─ os-tmpdir@1.0.2
├─ path-is-absolute@1.0.1
├─ path-parse@1.0.5
├─ path-to-regexp@0.1.7
├─ performance-now@2.1.0
├─ postcss-calc@5.3.1
├─ postcss-colormin@2.2.2
├─ postcss-convert-values@2.6.1
├─ postcss-discard-comments@2.0.4
├─ postcss-discard-duplicates@2.1.0
├─ postcss-discard-empty@2.1.0
├─ postcss-discard-overridden@0.1.1
├─ postcss-discard-unused@2.2.3
├─ postcss-filter-plugins@2.0.2
├─ postcss-merge-idents@2.1.7
├─ postcss-merge-longhand@2.0.2
├─ postcss-merge-rules@2.1.2
├─ postcss-message-helpers@2.0.0
├─ postcss-minify-font-values@1.0.5
├─ postcss-minify-gradients@1.0.5
├─ postcss-minify-params@1.2.2
├─ postcss-minify-selectors@2.1.1
├─ postcss-normalize-charset@1.1.1
├─ postcss-normalize-url@3.0.8
├─ postcss-ordered-values@2.2.3
├─ postcss-reduce-idents@2.4.0
├─ postcss-reduce-initial@1.0.1
├─ postcss-reduce-transforms@1.0.4
├─ postcss-selector-parser@2.2.3
├─ postcss-svgo@2.1.6
├─ postcss-unique-selectors@2.0.2
├─ postcss-zindex@2.2.0
├─ prepend-http@1.0.4
├─ private@0.1.8
├─ process-nextick-args@2.0.0
├─ promise@7.3.1
├─ proxy-addr@2.0.3
├─ punycode@1.4.1
├─ q@0.9.7
├─ query-string@4.3.4
├─ randomatic@3.0.0
├─ raw-body@2.3.2
├─ react-dom-factories@1.0.2
├─ react-dom@15.6.2
├─ react@15.6.2
├─ readable-stream@2.3.6
├─ rechoir@0.6.2
├─ reduce-css-calc@1.3.0
├─ reduce-function-call@1.0.2
├─ regenerate@1.4.0
├─ regenerator-runtime@0.10.5
├─ regenerator-transform@0.10.1
├─ regexpu-core@2.0.0
├─ regjsgen@0.2.0
├─ regjsparser@0.1.5
├─ repeat-element@1.1.2
├─ repeating@2.0.1
├─ request@2.86.0
├─ resolve@1.7.1
├─ safe-buffer@5.1.2
├─ safer-buffer@2.1.2
├─ sax@1.2.4
├─ semver@5.5.0
├─ serve-static@1.13.2
├─ set-getter@0.1.0
├─ setimmediate@1.0.5
├─ shelljs@0.7.8
├─ simple-swizzle@0.2.2
├─ sitemap@1.13.0
├─ slash@1.0.0
├─ sntp@2.1.0
├─ sort-keys@1.1.2
├─ source-map-support@0.4.18
├─ source-map@0.5.7
├─ sprintf-js@1.0.3
├─ sshpk@1.14.1
├─ strict-uri-encode@1.1.0
├─ string_decoder@1.1.1
├─ strip-ansi@3.0.1
├─ strip-color@0.1.0
├─ supports-color@2.0.0
├─ svgo@0.7.2
├─ tcp-port-used@0.1.2
├─ to-fast-properties@1.0.3
├─ to-object-path@0.3.0
├─ toml@2.3.3
├─ tough-cookie@2.3.4
├─ trim-right@1.0.1
├─ tunnel-agent@0.6.0
├─ tweetnacl@0.14.5
├─ type-is@1.6.16
├─ typedarray@0.0.6
├─ ua-parser-js@0.7.18
├─ underscore.string@2.4.0
├─ underscore@1.9.0
├─ uniq@1.0.1
├─ uniqid@4.1.1
├─ universalify@0.1.1
├─ unpipe@1.0.0
├─ url-join@1.1.0
├─ util-deprecate@1.0.2
├─ utils-merge@1.0.1
├─ uuid@3.2.1
├─ vary@1.1.2
├─ vendors@1.0.2
├─ verror@1.10.0
├─ whatwg-fetch@2.0.4
├─ whet.extend@0.9.9
├─ wordwrap@0.0.2
├─ xml@1.0.1
├─ yamljs@0.2.10
└─ yargs@2.3.0
Done in 5.15s.
warning No license field
Docusaurus installed in website folder!

yarn run v1.6.0
warning package.json: No license field
$ docusaurus-examples
Wrote docusaurus scripts to package.json file.

.gitignore already exists in /Users/alam/src/Docusaurus/website. Creating an example gitignore file for you to copy from if desired.

Example website created in Docusaurus/website

Rename Docusaurus/docs-examples-from-docusaurus to Docusaurus/docs to see the example docs on your site.

Rename Docusaurus/website/blog-examples-from-docusaurus to Docusaurus/website/blog to see the example blog posts on your site.

Done in 0.25s.

@yangshun
Copy link
Contributor

yangshun commented May 16, 2018

You'll have to be within Docusaurus/website. Use this command instead when testing -

$ node ../lib/copy-examples.js

to simulate the docusaurus-init command.

@amyrlam
Copy link
Contributor Author

amyrlam commented May 16, 2018

confused...

alam@tesla website (master) $ pwd
/Users/alam/src/Docusaurus/website
alam@tesla website (master) $ git reset --hard
HEAD is now at 1796764 Print out directory tree during docusaurus-init (#665)
alam@tesla website (master) $ node ../lib/copy-examples.js
Wrote docusaurus scripts to package.json file.

Example docs already exist! Rename or remove Docusaurus/docs-examples-from-docusaurus to regenerate example docs.

Example blog posts already exist! Rename or remove Docusaurus/website/blog-examples-from-docusaurus to regenerate example blog posts.

.gitignore already exists in /Users/alam/src/Docusaurus/website. Creating an example gitignore file for you to copy from if desired.

Footer.js already exists in website/core/. Rename or remove the file to regenerate an example version.

help.js already exists in website/pages/en/. Rename or remove the file to regenerate an example version.

index.js already exists in website/pages/en/. Rename or remove the file to regenerate an example version.

users.js already exists in website/pages/en/. Rename or remove the file to regenerate an example version.

sidebars.json already exists in website/. Rename or remove the file to regenerate an example version.

siteConfig.js already exists in website/. Rename or remove the file to regenerate an example version.

custom.css already exists in website/static/css/. Rename or remove the file to regenerate an example version.

docusaurus.svg already exists in website/static/img/. Rename or remove the file to regenerate an example version.

favicon.png already exists in website/static/img/. Rename or remove the file to regenerate an example version.

favicon.ico already exists in website/static/img/favicon/. Rename or remove the file to regenerate an example version.

oss_logo.png already exists in website/static/img/. Rename or remove the file to regenerate an example version.

alam@tesla website (master) $ rm -rf blog-examples-from-docusaurus/
alam@tesla website (master) $ node ../lib/copy-examples.js
Wrote docusaurus scripts to package.json file.

Example docs already exist! Rename or remove Docusaurus/docs-examples-from-docusaurus to regenerate example docs.

.gitignore already exists in /Users/alam/src/Docusaurus/website. Creating an example gitignore file for you to copy from if desired.

Footer.js already exists in website/core/. Rename or remove the file to regenerate an example version.

help.js already exists in website/pages/en/. Rename or remove the file to regenerate an example version.

index.js already exists in website/pages/en/. Rename or remove the file to regenerate an example version.

users.js already exists in website/pages/en/. Rename or remove the file to regenerate an example version.

sidebars.json already exists in website/. Rename or remove the file to regenerate an example version.

siteConfig.js already exists in website/. Rename or remove the file to regenerate an example version.

custom.css already exists in website/static/css/. Rename or remove the file to regenerate an example version.

docusaurus.svg already exists in website/static/img/. Rename or remove the file to regenerate an example version.

favicon.png already exists in website/static/img/. Rename or remove the file to regenerate an example version.

favicon.ico already exists in website/static/img/favicon/. Rename or remove the file to regenerate an example version.

oss_logo.png already exists in website/static/img/. Rename or remove the file to regenerate an example version.

module.js:538
    throw err;
    ^

Error: Cannot find module 'tree-node-cli'
    at Function.Module._resolveFilename (module.js:536:15)
    at Function.Module._load (module.js:466:25)
    at Module.require (module.js:579:17)
    at require (internal/module.js:11:18)
    at Object.<anonymous> (/Users/alam/src/Docusaurus/lib/copy-examples.js:206:18)
    at Module._compile (module.js:635:30)
    at Object.Module._extensions..js (module.js:646:10)
    at Module.load (module.js:554:32)
    at tryModuleLoad (module.js:497:12)
    at Function.Module._load (module.js:489:3)

@yangshun
Copy link
Contributor

I think you missed out on installing tree-node-cli. Do yarn install in the root of the repo.

@amyrlam
Copy link
Contributor Author

amyrlam commented May 16, 2018

Sorry, I could have sworn I had done that on multiple occasions. Having a lot of issues today locally! Appreciate the help debugging

@yangshun
Copy link
Contributor

Hope it works for you now! You will see more extra stuff because you're printing out the Docusaurus working directory, which is different from a clean slate docusaurus-init.

@amyrlam
Copy link
Contributor Author

amyrlam commented May 16, 2018

yeap! I finally saw the tree in Docusaurus for the first time 😅

@JoelMarcey JoelMarcey mentioned this pull request May 17, 2018
@amyrlam amyrlam deleted the amy/add-tree-node-cli branch October 2, 2018 05:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CLA Signed Signed Facebook CLA
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants